diff --git a/crates/bevy_input/src/keyboard.rs b/crates/bevy_input/src/keyboard.rs index cc14bac968689..8597476c1bcb3 100644 --- a/crates/bevy_input/src/keyboard.rs +++ b/crates/bevy_input/src/keyboard.rs @@ -318,16 +318,19 @@ pub enum KeyCode { /// The `Kanji` key. Kanji, - /// The `LAlt` / `Left Alt` key. Maps to `Left Option` on Mac. - LAlt, - /// The `LBracket` / `Left Bracket` key. - LBracket, - /// The `LControl` / `Left Control` key. - LControl, - /// The `LShift` / `Left Shift` key. - LShift, - /// The `LWin` / `Left Windows` key. Maps to `Left Command` on Mac. - LWin, + /// The `Left Alt` key. Maps to `Left Option` on Mac. + AltLeft, + /// The `Left Bracket` / `[` key. + BracketLeft, + /// The `Left Control` key. + ControlLeft, + /// The `Left Shift` key. + ShiftLeft, + /// The `Left Super` key. + /// Generic keyboards usually display this key with the *Microsoft Windows* logo. + /// Apple keyboards call this key the *Command Key* and display it using the ⌘ character. + #[doc(alias("LWin", "LMeta", "LLogo"))] + SuperLeft, /// The `Mail` key. Mail, @@ -368,16 +371,19 @@ pub enum KeyCode { /// The `PrevTrack` key. PrevTrack, - /// The `RAlt` / `Right Alt` key. Maps to `Right Option` on Mac. - RAlt, - /// The `RBracket` / `Right Bracket` key. - RBracket, - /// The `RControl` / `Right Control` key. - RControl, - /// The `RShift` / `Right Shift` key. - RShift, - /// The `RWin` / `Right Windows` key. Maps to `Right Command` on Mac. - RWin, + /// The `Right Alt` key. Maps to `Right Option` on Mac. + AltRight, + /// The `Right Bracket` / `]` key. + BracketRight, + /// The `Right Control` key. + ControlRight, + /// The `Right Shift` key. + ShiftRight, + /// The `Right Super` key. + /// Generic keyboards usually display this key with the *Microsoft Windows* logo. + /// Apple keyboards call this key the *Command Key* and display it using the ⌘ character. + #[doc(alias("RWin", "RMeta", "RLogo"))] + SuperRight, /// The `Semicolon` / `;` key. Semicolon, diff --git a/crates/bevy_winit/src/converters.rs b/crates/bevy_winit/src/converters.rs index 65591f6b9910d..550d6160dadba 100644 --- a/crates/bevy_winit/src/converters.rs +++ b/crates/bevy_winit/src/converters.rs @@ -172,11 +172,11 @@ pub fn convert_virtual_key_code(virtual_key_code: winit::event::VirtualKeyCode) winit::event::VirtualKeyCode::Grave => KeyCode::Grave, winit::event::VirtualKeyCode::Kana => KeyCode::Kana, winit::event::VirtualKeyCode::Kanji => KeyCode::Kanji, - winit::event::VirtualKeyCode::LAlt => KeyCode::LAlt, - winit::event::VirtualKeyCode::LBracket => KeyCode::LBracket, - winit::event::VirtualKeyCode::LControl => KeyCode::LControl, - winit::event::VirtualKeyCode::LShift => KeyCode::LShift, - winit::event::VirtualKeyCode::LWin => KeyCode::LWin, + winit::event::VirtualKeyCode::LAlt => KeyCode::AltLeft, + winit::event::VirtualKeyCode::LBracket => KeyCode::BracketLeft, + winit::event::VirtualKeyCode::LControl => KeyCode::ControlLeft, + winit::event::VirtualKeyCode::LShift => KeyCode::ShiftLeft, + winit::event::VirtualKeyCode::LWin => KeyCode::SuperLeft, winit::event::VirtualKeyCode::Mail => KeyCode::Mail, winit::event::VirtualKeyCode::MediaSelect => KeyCode::MediaSelect, winit::event::VirtualKeyCode::MediaStop => KeyCode::MediaStop, @@ -196,11 +196,11 @@ pub fn convert_virtual_key_code(virtual_key_code: winit::event::VirtualKeyCode) winit::event::VirtualKeyCode::PlayPause => KeyCode::PlayPause, winit::event::VirtualKeyCode::Power => KeyCode::Power, winit::event::VirtualKeyCode::PrevTrack => KeyCode::PrevTrack, - winit::event::VirtualKeyCode::RAlt => KeyCode::RAlt, - winit::event::VirtualKeyCode::RBracket => KeyCode::RBracket, - winit::event::VirtualKeyCode::RControl => KeyCode::RControl, - winit::event::VirtualKeyCode::RShift => KeyCode::RShift, - winit::event::VirtualKeyCode::RWin => KeyCode::RWin, + winit::event::VirtualKeyCode::RAlt => KeyCode::AltRight, + winit::event::VirtualKeyCode::RBracket => KeyCode::BracketRight, + winit::event::VirtualKeyCode::RControl => KeyCode::ControlRight, + winit::event::VirtualKeyCode::RShift => KeyCode::ShiftRight, + winit::event::VirtualKeyCode::RWin => KeyCode::SuperRight, winit::event::VirtualKeyCode::Semicolon => KeyCode::Semicolon, winit::event::VirtualKeyCode::Slash => KeyCode::Slash, winit::event::VirtualKeyCode::Sleep => KeyCode::Sleep, diff --git a/examples/3d/fog.rs b/examples/3d/fog.rs index bdd977df8ecb8..35d381ce0fced 100644 --- a/examples/3d/fog.rs +++ b/examples/3d/fog.rs @@ -284,12 +284,12 @@ fn update_system( fog.color.set_r(r); } - if keycode.pressed(KeyCode::LBracket) { + if keycode.pressed(KeyCode::BracketLeft) { let g = (fog.color.g() - 0.1 * delta).max(0.0); fog.color.set_g(g); } - if keycode.pressed(KeyCode::RBracket) { + if keycode.pressed(KeyCode::BracketRight) { let g = (fog.color.g() + 0.1 * delta).min(1.0); fog.color.set_g(g); } diff --git a/examples/3d/shadow_biases.rs b/examples/3d/shadow_biases.rs index a4fc96413681b..6ed89ce89f237 100644 --- a/examples/3d/shadow_biases.rs +++ b/examples/3d/shadow_biases.rs @@ -256,7 +256,7 @@ impl Default for CameraController { key_right: KeyCode::D, key_up: KeyCode::E, key_down: KeyCode::Q, - key_run: KeyCode::LShift, + key_run: KeyCode::ShiftLeft, walk_speed: 10.0, run_speed: 30.0, friction: 0.5, diff --git a/examples/3d/skybox.rs b/examples/3d/skybox.rs index 986114bfdba08..7cc6b91c4b5f6 100644 --- a/examples/3d/skybox.rs +++ b/examples/3d/skybox.rs @@ -209,7 +209,7 @@ impl Default for CameraController { key_right: KeyCode::D, key_up: KeyCode::E, key_down: KeyCode::Q, - key_run: KeyCode::LShift, + key_run: KeyCode::ShiftLeft, mouse_key_enable_mouse: MouseButton::Left, keyboard_key_enable_mouse: KeyCode::M, walk_speed: 2.0, diff --git a/examples/input/keyboard_modifiers.rs b/examples/input/keyboard_modifiers.rs index 271e133d7a063..1ec1232fbf1af 100644 --- a/examples/input/keyboard_modifiers.rs +++ b/examples/input/keyboard_modifiers.rs @@ -11,8 +11,8 @@ fn main() { /// This system prints when `Ctrl + Shift + A` is pressed fn keyboard_input_system(input: Res>) { - let shift = input.any_pressed([KeyCode::LShift, KeyCode::RShift]); - let ctrl = input.any_pressed([KeyCode::LControl, KeyCode::RControl]); + let shift = input.any_pressed([KeyCode::ShiftLeft, KeyCode::ShiftRight]); + let ctrl = input.any_pressed([KeyCode::ControlLeft, KeyCode::ControlRight]); if ctrl && shift && input.just_pressed(KeyCode::A) { info!("Just pressed Ctrl + Shift + A!"); diff --git a/examples/tools/scene_viewer/camera_controller_plugin.rs b/examples/tools/scene_viewer/camera_controller_plugin.rs index eac0d5baf7066..f786b2f04b80d 100644 --- a/examples/tools/scene_viewer/camera_controller_plugin.rs +++ b/examples/tools/scene_viewer/camera_controller_plugin.rs @@ -48,7 +48,7 @@ impl Default for CameraController { key_right: KeyCode::D, key_up: KeyCode::E, key_down: KeyCode::Q, - key_run: KeyCode::LShift, + key_run: KeyCode::ShiftLeft, mouse_key_enable_mouse: MouseButton::Left, keyboard_key_enable_mouse: KeyCode::M, walk_speed: 5.0,