diff --git a/crates/bevy_input/src/common_conditions.rs b/crates/bevy_input/src/common_conditions.rs index 4a7e4dd7bed9f1..d4615c3f9b9f8b 100644 --- a/crates/bevy_input/src/common_conditions.rs +++ b/crates/bevy_input/src/common_conditions.rs @@ -7,12 +7,12 @@ use std::hash::Hash; /// ```no_run /// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update}; /// # use bevy_ecs::prelude::IntoSystemConfigs; -/// # use bevy_input::{common_conditions::input_toggle_active, prelude::KeyCode}; +/// # use bevy_input::{common_conditions::input_toggle_active, prelude::PhysicalKeyCode}; /// /// fn main() { /// App::new() /// .add_plugins(DefaultPlugins) -/// .add_systems(Update, pause_menu.run_if(input_toggle_active(false, KeyCode::Escape))) +/// .add_systems(Update, pause_menu.run_if(input_toggle_active(false, PhysicalKeyCode::Escape))) /// .run(); /// } /// @@ -26,7 +26,7 @@ use std::hash::Hash; /// ```no_run /// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update}; /// # use bevy_ecs::prelude::{IntoSystemConfigs, Res, ResMut, Resource}; -/// # use bevy_input::{common_conditions::input_just_pressed, prelude::KeyCode}; +/// # use bevy_input::{common_conditions::input_just_pressed, prelude::PhysicalKeyCode}; /// /// #[derive(Resource, Default)] /// struct Paused(bool); @@ -35,7 +35,7 @@ use std::hash::Hash; /// App::new() /// .add_plugins(DefaultPlugins) /// .init_resource::() -/// .add_systems(Update, toggle_pause_state.run_if(input_just_pressed(KeyCode::Escape))) +/// .add_systems(Update, toggle_pause_state.run_if(input_just_pressed(PhysicalKeyCode::Escape))) /// .add_systems(Update, pause_menu.run_if(|paused: Res| paused.0)) /// .run(); /// } @@ -76,11 +76,11 @@ where /// ```no_run /// # use bevy_app::{App, NoopPluginGroup as DefaultPlugins, Update}; /// # use bevy_ecs::prelude::IntoSystemConfigs; -/// # use bevy_input::{common_conditions::input_just_pressed, prelude::KeyCode}; +/// # use bevy_input::{common_conditions::input_just_pressed, prelude::PhysicalKeyCode}; /// fn main() { /// App::new() /// .add_plugins(DefaultPlugins) -/// .add_systems(Update, jump.run_if(input_just_pressed(KeyCode::Space))) +/// .add_systems(Update, jump.run_if(input_just_pressed(PhysicalKeyCode::Space))) /// .run(); /// } /// @@ -104,7 +104,7 @@ where #[cfg(test)] mod tests { use super::*; - use crate::prelude::KeyCode; + use crate::prelude::PhysicalKeyCode; use bevy_ecs::schedule::{IntoSystemConfigs, Schedule}; fn test_system() {} @@ -114,10 +114,10 @@ mod tests { fn distributive_run_if_compiles() { Schedule::default().add_systems( (test_system, test_system) - .distributive_run_if(input_toggle_active(false, KeyCode::Escape)) - .distributive_run_if(input_pressed(KeyCode::Escape)) - .distributive_run_if(input_just_pressed(KeyCode::Escape)) - .distributive_run_if(input_just_released(KeyCode::Escape)), + .distributive_run_if(input_toggle_active(false, PhysicalKeyCode::Escape)) + .distributive_run_if(input_pressed(PhysicalKeyCode::Escape)) + .distributive_run_if(input_just_pressed(PhysicalKeyCode::Escape)) + .distributive_run_if(input_just_released(PhysicalKeyCode::Escape)), ); } } diff --git a/crates/bevy_input/src/keyboard.rs b/crates/bevy_input/src/keyboard.rs index 3465403871f453..d469fd7eab32f0 100644 --- a/crates/bevy_input/src/keyboard.rs +++ b/crates/bevy_input/src/keyboard.rs @@ -1,19 +1,19 @@ //! The keyboard input functionality. // This file contains a substantial portion of the UI Events Specification by the W3C. In -// particular, the variant names within `KeyCode` and their documentation are modified +// particular, the variant names within `PhysicalKeyCode` and their documentation are modified // versions of contents of the aforementioned specification. // // The original documents are: // // -// ### For `KeyCode` +// ### For `PhysicalKeyCode` // UI Events KeyboardEvent code Values // https://www.w3.org/TR/2017/CR-uievents-code-20170601/ // Copyright © 2017 W3C® (MIT, ERCIM, Keio, Beihang). // // These documents were used under the terms of the following license. This W3C license as well as -// the W3C short notice apply to the `KeyCode` enums and their variants and the +// the W3C short notice apply to the `PhysicalKeyCode` enums and their variants and the // documentation attached to their variants. // --------- BEGGINING OF W3C LICENSE -------------------------------------------------------------- @@ -86,7 +86,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// ## Usage /// /// The event is consumed inside of the [`keyboard_input_system`] -/// to update the [`Input`](ButtonInput) resource. +/// to update the [`Input`](ButtonInput) resource. #[derive(Event, Debug, Clone, PartialEq, Eq, Reflect)] #[reflect(Debug, PartialEq)] #[cfg_attr( @@ -96,7 +96,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; )] pub struct KeyboardInput { /// The physical key code of the key. - pub key_code: KeyCode, + pub key_code: PhysicalKeyCode, /// The logical key of the input pub logical_key: Key, /// The press state of the key. @@ -105,14 +105,14 @@ pub struct KeyboardInput { pub window: Entity, } -/// Updates the [`ButtonInput`] resource with the latest [`KeyboardInput`] events. +/// Updates the [`ButtonInput`] resource with the latest [`KeyboardInput`] events. /// /// ## Differences /// -/// The main difference between the [`KeyboardInput`] event and the [`ButtonInput`] resources is that +/// The main difference between the [`KeyboardInput`] event and the [`ButtonInput`] resources is that /// the latter have convenient functions such as [`ButtonInput::pressed`], [`ButtonInput::just_pressed`] and [`ButtonInput::just_released`]. pub fn keyboard_input_system( - mut key_input: ResMut>, + mut key_input: ResMut>, mut keyboard_input_events: EventReader, ) { // Avoid clearing if it's not empty to ensure change detection is not triggered. @@ -134,8 +134,8 @@ pub fn keyboard_input_system( /// enum), but the values are primarily tied to the key's physical location on the keyboard. /// /// This enum is primarily used to store raw keycodes when Winit doesn't map a given native -/// physical key identifier to a meaningful [`KeyCode`] variant. In the presence of identifiers we -/// haven't mapped for you yet, this lets you use use [`KeyCode`] to: +/// physical key identifier to a meaningful [`PhysicalKeyCode`] variant. In the presence of identifiers we +/// haven't mapped for you yet, this lets you use use [`PhysicalKeyCode`] to: /// /// - Correctly match key press and release events. /// - On non-web platforms, support assigning keybinds to virtually any key through a UI. @@ -162,7 +162,7 @@ pub enum NativeKeyCode { /// /// ## Usage /// -/// It is used as the generic `T` value of an [`ButtonInput`] to create a `Res>`. +/// It is used as the generic `T` value of an [`ButtonInput`] to create a `Res>`. /// /// Code representing the location of a physical key /// This mostly conforms to the UI Events Specification's [`KeyboardEvent.code`] with a few @@ -184,11 +184,11 @@ pub enum NativeKeyCode { reflect(Serialize, Deserialize) )] #[repr(u32)] -pub enum KeyCode { +pub enum PhysicalKeyCode { /// This variant is used when the key cannot be translated to any other variant. /// /// The native keycode is provided (if available) so you're able to more reliably match - /// key-press and key-release events by hashing the [`KeyCode`]. It is also possible to use + /// key-press and key-release events by hashing the [`PhysicalKeyCode`]. It is also possible to use /// this for keybinds for non-standard keys, but such keybinds are tied to a given platform. Unidentified(NativeKeyCode), /// ` on a US keyboard. This is also called a backtick or grave. diff --git a/crates/bevy_input/src/lib.rs b/crates/bevy_input/src/lib.rs index e6841ace816368..b536eada067c50 100644 --- a/crates/bevy_input/src/lib.rs +++ b/crates/bevy_input/src/lib.rs @@ -24,7 +24,7 @@ pub mod prelude { gamepad::{ Gamepad, GamepadAxis, GamepadAxisType, GamepadButton, GamepadButtonType, Gamepads, }, - keyboard::KeyCode, + keyboard::PhysicalKeyCode, mouse::MouseButton, touch::{TouchInput, Touches}, Axis, ButtonInput, @@ -34,7 +34,9 @@ pub mod prelude { use bevy_app::prelude::*; use bevy_ecs::prelude::*; use bevy_reflect::Reflect; -use keyboard::{keyboard_input_system, Key, KeyCode, KeyboardInput, NativeKey, NativeKeyCode}; +use keyboard::{ + keyboard_input_system, Key, KeyboardInput, NativeKey, NativeKeyCode, PhysicalKeyCode, +}; use mouse::{ mouse_button_input_system, MouseButton, MouseButtonInput, MouseMotion, MouseScrollUnit, MouseWheel, @@ -66,7 +68,7 @@ impl Plugin for InputPlugin { app // keyboard .add_event::() - .init_resource::>() + .init_resource::>() .add_systems(PreUpdate, keyboard_input_system.in_set(InputSystem)) // mouse .add_event::() @@ -112,7 +114,7 @@ impl Plugin for InputPlugin { // Register keyboard types app.register_type::() - .register_type::() + .register_type::() .register_type::() .register_type::() .register_type::(); diff --git a/crates/bevy_window/src/system.rs b/crates/bevy_window/src/system.rs index 96db42c96c2527..3596b6cdcf74eb 100644 --- a/crates/bevy_window/src/system.rs +++ b/crates/bevy_window/src/system.rs @@ -2,7 +2,7 @@ use crate::{PrimaryWindow, Window, WindowCloseRequested}; use bevy_app::AppExit; use bevy_ecs::prelude::*; -use bevy_input::{keyboard::KeyCode, ButtonInput}; +use bevy_input::{keyboard::PhysicalKeyCode, ButtonInput}; /// Exit the application when there are no open windows. /// @@ -52,14 +52,14 @@ pub fn close_when_requested(mut commands: Commands, mut closed: EventReader, - input: Res>, + input: Res>, ) { for (window, focus) in focused_windows.iter() { if !focus.focused { continue; } - if input.just_pressed(KeyCode::Escape) { + if input.just_pressed(PhysicalKeyCode::Escape) { commands.entity(window).despawn(); } } diff --git a/crates/bevy_winit/src/converters.rs b/crates/bevy_winit/src/converters.rs index 5cc2c034755286..f777705fc7d6e6 100644 --- a/crates/bevy_winit/src/converters.rs +++ b/crates/bevy_winit/src/converters.rs @@ -1,6 +1,6 @@ use bevy_ecs::entity::Entity; use bevy_input::{ - keyboard::{KeyCode, KeyboardInput, NativeKeyCode}, + keyboard::{KeyboardInput, NativeKeyCode, PhysicalKeyCode}, mouse::MouseButton, touch::{ForceTouch, TouchInput, TouchPhase}, ButtonState, @@ -80,207 +80,209 @@ pub fn convert_physical_native_key_code( winit::keyboard::NativeKeyCode::Xkb(key_code) => NativeKeyCode::Xkb(key_code), } } -pub fn convert_physical_key_code(virtual_key_code: winit::keyboard::PhysicalKey) -> KeyCode { +pub fn convert_physical_key_code( + virtual_key_code: winit::keyboard::PhysicalKey, +) -> PhysicalKeyCode { match virtual_key_code { winit::keyboard::PhysicalKey::Unidentified(native_key_code) => { - KeyCode::Unidentified(convert_physical_native_key_code(native_key_code)) + PhysicalKeyCode::Unidentified(convert_physical_native_key_code(native_key_code)) } winit::keyboard::PhysicalKey::Code(code) => match code { - winit::keyboard::KeyCode::Backquote => KeyCode::Backquote, - winit::keyboard::KeyCode::Backslash => KeyCode::Backslash, - winit::keyboard::KeyCode::BracketLeft => KeyCode::BracketLeft, - winit::keyboard::KeyCode::BracketRight => KeyCode::BracketRight, - winit::keyboard::KeyCode::Comma => KeyCode::Comma, - winit::keyboard::KeyCode::Digit0 => KeyCode::Digit0, - winit::keyboard::KeyCode::Digit1 => KeyCode::Digit1, - winit::keyboard::KeyCode::Digit2 => KeyCode::Digit2, - winit::keyboard::KeyCode::Digit3 => KeyCode::Digit3, - winit::keyboard::KeyCode::Digit4 => KeyCode::Digit4, - winit::keyboard::KeyCode::Digit5 => KeyCode::Digit5, - winit::keyboard::KeyCode::Digit6 => KeyCode::Digit6, - winit::keyboard::KeyCode::Digit7 => KeyCode::Digit7, - winit::keyboard::KeyCode::Digit8 => KeyCode::Digit8, - winit::keyboard::KeyCode::Digit9 => KeyCode::Digit9, - winit::keyboard::KeyCode::Equal => KeyCode::Equal, - winit::keyboard::KeyCode::IntlBackslash => KeyCode::IntlBackslash, - winit::keyboard::KeyCode::IntlRo => KeyCode::IntlRo, - winit::keyboard::KeyCode::IntlYen => KeyCode::IntlYen, - winit::keyboard::KeyCode::KeyA => KeyCode::KeyA, - winit::keyboard::KeyCode::KeyB => KeyCode::KeyB, - winit::keyboard::KeyCode::KeyC => KeyCode::KeyC, - winit::keyboard::KeyCode::KeyD => KeyCode::KeyD, - winit::keyboard::KeyCode::KeyE => KeyCode::KeyE, - winit::keyboard::KeyCode::KeyF => KeyCode::KeyF, - winit::keyboard::KeyCode::KeyG => KeyCode::KeyG, - winit::keyboard::KeyCode::KeyH => KeyCode::KeyH, - winit::keyboard::KeyCode::KeyI => KeyCode::KeyI, - winit::keyboard::KeyCode::KeyJ => KeyCode::KeyJ, - winit::keyboard::KeyCode::KeyK => KeyCode::KeyK, - winit::keyboard::KeyCode::KeyL => KeyCode::KeyL, - winit::keyboard::KeyCode::KeyM => KeyCode::KeyM, - winit::keyboard::KeyCode::KeyN => KeyCode::KeyN, - winit::keyboard::KeyCode::KeyO => KeyCode::KeyO, - winit::keyboard::KeyCode::KeyP => KeyCode::KeyP, - winit::keyboard::KeyCode::KeyQ => KeyCode::KeyQ, - winit::keyboard::KeyCode::KeyR => KeyCode::KeyR, - winit::keyboard::KeyCode::KeyS => KeyCode::KeyS, - winit::keyboard::KeyCode::KeyT => KeyCode::KeyT, - winit::keyboard::KeyCode::KeyU => KeyCode::KeyU, - winit::keyboard::KeyCode::KeyV => KeyCode::KeyV, - winit::keyboard::KeyCode::KeyW => KeyCode::KeyW, - winit::keyboard::KeyCode::KeyX => KeyCode::KeyX, - winit::keyboard::KeyCode::KeyY => KeyCode::KeyY, - winit::keyboard::KeyCode::KeyZ => KeyCode::KeyZ, - winit::keyboard::KeyCode::Minus => KeyCode::Minus, - winit::keyboard::KeyCode::Period => KeyCode::Period, - winit::keyboard::KeyCode::Quote => KeyCode::Quote, - winit::keyboard::KeyCode::Semicolon => KeyCode::Semicolon, - winit::keyboard::KeyCode::Slash => KeyCode::Slash, - winit::keyboard::KeyCode::AltLeft => KeyCode::AltLeft, - winit::keyboard::KeyCode::AltRight => KeyCode::AltRight, - winit::keyboard::KeyCode::Backspace => KeyCode::Backspace, - winit::keyboard::KeyCode::CapsLock => KeyCode::CapsLock, - winit::keyboard::KeyCode::ContextMenu => KeyCode::ContextMenu, - winit::keyboard::KeyCode::ControlLeft => KeyCode::ControlLeft, - winit::keyboard::KeyCode::ControlRight => KeyCode::ControlRight, - winit::keyboard::KeyCode::Enter => KeyCode::Enter, - winit::keyboard::KeyCode::SuperLeft => KeyCode::SuperLeft, - winit::keyboard::KeyCode::SuperRight => KeyCode::SuperRight, - winit::keyboard::KeyCode::ShiftLeft => KeyCode::ShiftLeft, - winit::keyboard::KeyCode::ShiftRight => KeyCode::ShiftRight, - winit::keyboard::KeyCode::Space => KeyCode::Space, - winit::keyboard::KeyCode::Tab => KeyCode::Tab, - winit::keyboard::KeyCode::Convert => KeyCode::Convert, - winit::keyboard::KeyCode::KanaMode => KeyCode::KanaMode, - winit::keyboard::KeyCode::Lang1 => KeyCode::Lang1, - winit::keyboard::KeyCode::Lang2 => KeyCode::Lang2, - winit::keyboard::KeyCode::Lang3 => KeyCode::Lang3, - winit::keyboard::KeyCode::Lang4 => KeyCode::Lang4, - winit::keyboard::KeyCode::Lang5 => KeyCode::Lang5, - winit::keyboard::KeyCode::NonConvert => KeyCode::NonConvert, - winit::keyboard::KeyCode::Delete => KeyCode::Delete, - winit::keyboard::KeyCode::End => KeyCode::End, - winit::keyboard::KeyCode::Help => KeyCode::Help, - winit::keyboard::KeyCode::Home => KeyCode::Home, - winit::keyboard::KeyCode::Insert => KeyCode::Insert, - winit::keyboard::KeyCode::PageDown => KeyCode::PageDown, - winit::keyboard::KeyCode::PageUp => KeyCode::PageUp, - winit::keyboard::KeyCode::ArrowDown => KeyCode::ArrowDown, - winit::keyboard::KeyCode::ArrowLeft => KeyCode::ArrowLeft, - winit::keyboard::KeyCode::ArrowRight => KeyCode::ArrowRight, - winit::keyboard::KeyCode::ArrowUp => KeyCode::ArrowUp, - winit::keyboard::KeyCode::NumLock => KeyCode::NumLock, - winit::keyboard::KeyCode::Numpad0 => KeyCode::Numpad0, - winit::keyboard::KeyCode::Numpad1 => KeyCode::Numpad1, - winit::keyboard::KeyCode::Numpad2 => KeyCode::Numpad2, - winit::keyboard::KeyCode::Numpad3 => KeyCode::Numpad3, - winit::keyboard::KeyCode::Numpad4 => KeyCode::Numpad4, - winit::keyboard::KeyCode::Numpad5 => KeyCode::Numpad5, - winit::keyboard::KeyCode::Numpad6 => KeyCode::Numpad6, - winit::keyboard::KeyCode::Numpad7 => KeyCode::Numpad7, - winit::keyboard::KeyCode::Numpad8 => KeyCode::Numpad8, - winit::keyboard::KeyCode::Numpad9 => KeyCode::Numpad9, - winit::keyboard::KeyCode::NumpadAdd => KeyCode::NumpadAdd, - winit::keyboard::KeyCode::NumpadBackspace => KeyCode::NumpadBackspace, - winit::keyboard::KeyCode::NumpadClear => KeyCode::NumpadClear, - winit::keyboard::KeyCode::NumpadClearEntry => KeyCode::NumpadClearEntry, - winit::keyboard::KeyCode::NumpadComma => KeyCode::NumpadComma, - winit::keyboard::KeyCode::NumpadDecimal => KeyCode::NumpadDecimal, - winit::keyboard::KeyCode::NumpadDivide => KeyCode::NumpadDivide, - winit::keyboard::KeyCode::NumpadEnter => KeyCode::NumpadEnter, - winit::keyboard::KeyCode::NumpadEqual => KeyCode::NumpadEqual, - winit::keyboard::KeyCode::NumpadHash => KeyCode::NumpadHash, - winit::keyboard::KeyCode::NumpadMemoryAdd => KeyCode::NumpadMemoryAdd, - winit::keyboard::KeyCode::NumpadMemoryClear => KeyCode::NumpadMemoryClear, - winit::keyboard::KeyCode::NumpadMemoryRecall => KeyCode::NumpadMemoryRecall, - winit::keyboard::KeyCode::NumpadMemoryStore => KeyCode::NumpadMemoryStore, - winit::keyboard::KeyCode::NumpadMemorySubtract => KeyCode::NumpadMemorySubtract, - winit::keyboard::KeyCode::NumpadMultiply => KeyCode::NumpadMultiply, - winit::keyboard::KeyCode::NumpadParenLeft => KeyCode::NumpadParenLeft, - winit::keyboard::KeyCode::NumpadParenRight => KeyCode::NumpadParenRight, - winit::keyboard::KeyCode::NumpadStar => KeyCode::NumpadStar, - winit::keyboard::KeyCode::NumpadSubtract => KeyCode::NumpadSubtract, - winit::keyboard::KeyCode::Escape => KeyCode::Escape, - winit::keyboard::KeyCode::Fn => KeyCode::Fn, - winit::keyboard::KeyCode::FnLock => KeyCode::FnLock, - winit::keyboard::KeyCode::PrintScreen => KeyCode::PrintScreen, - winit::keyboard::KeyCode::ScrollLock => KeyCode::ScrollLock, - winit::keyboard::KeyCode::Pause => KeyCode::Pause, - winit::keyboard::KeyCode::BrowserBack => KeyCode::BrowserBack, - winit::keyboard::KeyCode::BrowserFavorites => KeyCode::BrowserFavorites, - winit::keyboard::KeyCode::BrowserForward => KeyCode::BrowserForward, - winit::keyboard::KeyCode::BrowserHome => KeyCode::BrowserHome, - winit::keyboard::KeyCode::BrowserRefresh => KeyCode::BrowserRefresh, - winit::keyboard::KeyCode::BrowserSearch => KeyCode::BrowserSearch, - winit::keyboard::KeyCode::BrowserStop => KeyCode::BrowserStop, - winit::keyboard::KeyCode::Eject => KeyCode::Eject, - winit::keyboard::KeyCode::LaunchApp1 => KeyCode::LaunchApp1, - winit::keyboard::KeyCode::LaunchApp2 => KeyCode::LaunchApp2, - winit::keyboard::KeyCode::LaunchMail => KeyCode::LaunchMail, - winit::keyboard::KeyCode::MediaPlayPause => KeyCode::MediaPlayPause, - winit::keyboard::KeyCode::MediaSelect => KeyCode::MediaSelect, - winit::keyboard::KeyCode::MediaStop => KeyCode::MediaStop, - winit::keyboard::KeyCode::MediaTrackNext => KeyCode::MediaTrackNext, - winit::keyboard::KeyCode::MediaTrackPrevious => KeyCode::MediaTrackPrevious, - winit::keyboard::KeyCode::Power => KeyCode::Power, - winit::keyboard::KeyCode::Sleep => KeyCode::Sleep, - winit::keyboard::KeyCode::AudioVolumeDown => KeyCode::AudioVolumeDown, - winit::keyboard::KeyCode::AudioVolumeMute => KeyCode::AudioVolumeMute, - winit::keyboard::KeyCode::AudioVolumeUp => KeyCode::AudioVolumeUp, - winit::keyboard::KeyCode::WakeUp => KeyCode::WakeUp, - winit::keyboard::KeyCode::Meta => KeyCode::Meta, - winit::keyboard::KeyCode::Hyper => KeyCode::Hyper, - winit::keyboard::KeyCode::Turbo => KeyCode::Turbo, - winit::keyboard::KeyCode::Abort => KeyCode::Abort, - winit::keyboard::KeyCode::Resume => KeyCode::Resume, - winit::keyboard::KeyCode::Suspend => KeyCode::Suspend, - winit::keyboard::KeyCode::Again => KeyCode::Again, - winit::keyboard::KeyCode::Copy => KeyCode::Copy, - winit::keyboard::KeyCode::Cut => KeyCode::Cut, - winit::keyboard::KeyCode::Find => KeyCode::Find, - winit::keyboard::KeyCode::Open => KeyCode::Open, - winit::keyboard::KeyCode::Paste => KeyCode::Paste, - winit::keyboard::KeyCode::Props => KeyCode::Props, - winit::keyboard::KeyCode::Select => KeyCode::Select, - winit::keyboard::KeyCode::Undo => KeyCode::Undo, - winit::keyboard::KeyCode::Hiragana => KeyCode::Hiragana, - winit::keyboard::KeyCode::Katakana => KeyCode::Katakana, - winit::keyboard::KeyCode::F1 => KeyCode::F1, - winit::keyboard::KeyCode::F2 => KeyCode::F2, - winit::keyboard::KeyCode::F3 => KeyCode::F3, - winit::keyboard::KeyCode::F4 => KeyCode::F4, - winit::keyboard::KeyCode::F5 => KeyCode::F5, - winit::keyboard::KeyCode::F6 => KeyCode::F6, - winit::keyboard::KeyCode::F7 => KeyCode::F7, - winit::keyboard::KeyCode::F8 => KeyCode::F8, - winit::keyboard::KeyCode::F9 => KeyCode::F9, - winit::keyboard::KeyCode::F10 => KeyCode::F10, - winit::keyboard::KeyCode::F11 => KeyCode::F11, - winit::keyboard::KeyCode::F12 => KeyCode::F12, - winit::keyboard::KeyCode::F13 => KeyCode::F13, - winit::keyboard::KeyCode::F14 => KeyCode::F14, - winit::keyboard::KeyCode::F15 => KeyCode::F15, - winit::keyboard::KeyCode::F16 => KeyCode::F16, - winit::keyboard::KeyCode::F17 => KeyCode::F17, - winit::keyboard::KeyCode::F18 => KeyCode::F18, - winit::keyboard::KeyCode::F19 => KeyCode::F19, - winit::keyboard::KeyCode::F20 => KeyCode::F20, - winit::keyboard::KeyCode::F21 => KeyCode::F21, - winit::keyboard::KeyCode::F22 => KeyCode::F22, - winit::keyboard::KeyCode::F23 => KeyCode::F23, - winit::keyboard::KeyCode::F24 => KeyCode::F24, - winit::keyboard::KeyCode::F25 => KeyCode::F25, - winit::keyboard::KeyCode::F26 => KeyCode::F26, - winit::keyboard::KeyCode::F27 => KeyCode::F27, - winit::keyboard::KeyCode::F28 => KeyCode::F28, - winit::keyboard::KeyCode::F29 => KeyCode::F29, - winit::keyboard::KeyCode::F30 => KeyCode::F30, - winit::keyboard::KeyCode::F31 => KeyCode::F31, - winit::keyboard::KeyCode::F32 => KeyCode::F32, - winit::keyboard::KeyCode::F33 => KeyCode::F33, - winit::keyboard::KeyCode::F34 => KeyCode::F34, - winit::keyboard::KeyCode::F35 => KeyCode::F35, - _ => KeyCode::Unidentified(NativeKeyCode::Unidentified), + winit::keyboard::KeyCode::Backquote => PhysicalKeyCode::Backquote, + winit::keyboard::KeyCode::Backslash => PhysicalKeyCode::Backslash, + winit::keyboard::KeyCode::BracketLeft => PhysicalKeyCode::BracketLeft, + winit::keyboard::KeyCode::BracketRight => PhysicalKeyCode::BracketRight, + winit::keyboard::KeyCode::Comma => PhysicalKeyCode::Comma, + winit::keyboard::KeyCode::Digit0 => PhysicalKeyCode::Digit0, + winit::keyboard::KeyCode::Digit1 => PhysicalKeyCode::Digit1, + winit::keyboard::KeyCode::Digit2 => PhysicalKeyCode::Digit2, + winit::keyboard::KeyCode::Digit3 => PhysicalKeyCode::Digit3, + winit::keyboard::KeyCode::Digit4 => PhysicalKeyCode::Digit4, + winit::keyboard::KeyCode::Digit5 => PhysicalKeyCode::Digit5, + winit::keyboard::KeyCode::Digit6 => PhysicalKeyCode::Digit6, + winit::keyboard::KeyCode::Digit7 => PhysicalKeyCode::Digit7, + winit::keyboard::KeyCode::Digit8 => PhysicalKeyCode::Digit8, + winit::keyboard::KeyCode::Digit9 => PhysicalKeyCode::Digit9, + winit::keyboard::KeyCode::Equal => PhysicalKeyCode::Equal, + winit::keyboard::KeyCode::IntlBackslash => PhysicalKeyCode::IntlBackslash, + winit::keyboard::KeyCode::IntlRo => PhysicalKeyCode::IntlRo, + winit::keyboard::KeyCode::IntlYen => PhysicalKeyCode::IntlYen, + winit::keyboard::KeyCode::KeyA => PhysicalKeyCode::KeyA, + winit::keyboard::KeyCode::KeyB => PhysicalKeyCode::KeyB, + winit::keyboard::KeyCode::KeyC => PhysicalKeyCode::KeyC, + winit::keyboard::KeyCode::KeyD => PhysicalKeyCode::KeyD, + winit::keyboard::KeyCode::KeyE => PhysicalKeyCode::KeyE, + winit::keyboard::KeyCode::KeyF => PhysicalKeyCode::KeyF, + winit::keyboard::KeyCode::KeyG => PhysicalKeyCode::KeyG, + winit::keyboard::KeyCode::KeyH => PhysicalKeyCode::KeyH, + winit::keyboard::KeyCode::KeyI => PhysicalKeyCode::KeyI, + winit::keyboard::KeyCode::KeyJ => PhysicalKeyCode::KeyJ, + winit::keyboard::KeyCode::KeyK => PhysicalKeyCode::KeyK, + winit::keyboard::KeyCode::KeyL => PhysicalKeyCode::KeyL, + winit::keyboard::KeyCode::KeyM => PhysicalKeyCode::KeyM, + winit::keyboard::KeyCode::KeyN => PhysicalKeyCode::KeyN, + winit::keyboard::KeyCode::KeyO => PhysicalKeyCode::KeyO, + winit::keyboard::KeyCode::KeyP => PhysicalKeyCode::KeyP, + winit::keyboard::KeyCode::KeyQ => PhysicalKeyCode::KeyQ, + winit::keyboard::KeyCode::KeyR => PhysicalKeyCode::KeyR, + winit::keyboard::KeyCode::KeyS => PhysicalKeyCode::KeyS, + winit::keyboard::KeyCode::KeyT => PhysicalKeyCode::KeyT, + winit::keyboard::KeyCode::KeyU => PhysicalKeyCode::KeyU, + winit::keyboard::KeyCode::KeyV => PhysicalKeyCode::KeyV, + winit::keyboard::KeyCode::KeyW => PhysicalKeyCode::KeyW, + winit::keyboard::KeyCode::KeyX => PhysicalKeyCode::KeyX, + winit::keyboard::KeyCode::KeyY => PhysicalKeyCode::KeyY, + winit::keyboard::KeyCode::KeyZ => PhysicalKeyCode::KeyZ, + winit::keyboard::KeyCode::Minus => PhysicalKeyCode::Minus, + winit::keyboard::KeyCode::Period => PhysicalKeyCode::Period, + winit::keyboard::KeyCode::Quote => PhysicalKeyCode::Quote, + winit::keyboard::KeyCode::Semicolon => PhysicalKeyCode::Semicolon, + winit::keyboard::KeyCode::Slash => PhysicalKeyCode::Slash, + winit::keyboard::KeyCode::AltLeft => PhysicalKeyCode::AltLeft, + winit::keyboard::KeyCode::AltRight => PhysicalKeyCode::AltRight, + winit::keyboard::KeyCode::Backspace => PhysicalKeyCode::Backspace, + winit::keyboard::KeyCode::CapsLock => PhysicalKeyCode::CapsLock, + winit::keyboard::KeyCode::ContextMenu => PhysicalKeyCode::ContextMenu, + winit::keyboard::KeyCode::ControlLeft => PhysicalKeyCode::ControlLeft, + winit::keyboard::KeyCode::ControlRight => PhysicalKeyCode::ControlRight, + winit::keyboard::KeyCode::Enter => PhysicalKeyCode::Enter, + winit::keyboard::KeyCode::SuperLeft => PhysicalKeyCode::SuperLeft, + winit::keyboard::KeyCode::SuperRight => PhysicalKeyCode::SuperRight, + winit::keyboard::KeyCode::ShiftLeft => PhysicalKeyCode::ShiftLeft, + winit::keyboard::KeyCode::ShiftRight => PhysicalKeyCode::ShiftRight, + winit::keyboard::KeyCode::Space => PhysicalKeyCode::Space, + winit::keyboard::KeyCode::Tab => PhysicalKeyCode::Tab, + winit::keyboard::KeyCode::Convert => PhysicalKeyCode::Convert, + winit::keyboard::KeyCode::KanaMode => PhysicalKeyCode::KanaMode, + winit::keyboard::KeyCode::Lang1 => PhysicalKeyCode::Lang1, + winit::keyboard::KeyCode::Lang2 => PhysicalKeyCode::Lang2, + winit::keyboard::KeyCode::Lang3 => PhysicalKeyCode::Lang3, + winit::keyboard::KeyCode::Lang4 => PhysicalKeyCode::Lang4, + winit::keyboard::KeyCode::Lang5 => PhysicalKeyCode::Lang5, + winit::keyboard::KeyCode::NonConvert => PhysicalKeyCode::NonConvert, + winit::keyboard::KeyCode::Delete => PhysicalKeyCode::Delete, + winit::keyboard::KeyCode::End => PhysicalKeyCode::End, + winit::keyboard::KeyCode::Help => PhysicalKeyCode::Help, + winit::keyboard::KeyCode::Home => PhysicalKeyCode::Home, + winit::keyboard::KeyCode::Insert => PhysicalKeyCode::Insert, + winit::keyboard::KeyCode::PageDown => PhysicalKeyCode::PageDown, + winit::keyboard::KeyCode::PageUp => PhysicalKeyCode::PageUp, + winit::keyboard::KeyCode::ArrowDown => PhysicalKeyCode::ArrowDown, + winit::keyboard::KeyCode::ArrowLeft => PhysicalKeyCode::ArrowLeft, + winit::keyboard::KeyCode::ArrowRight => PhysicalKeyCode::ArrowRight, + winit::keyboard::KeyCode::ArrowUp => PhysicalKeyCode::ArrowUp, + winit::keyboard::KeyCode::NumLock => PhysicalKeyCode::NumLock, + winit::keyboard::KeyCode::Numpad0 => PhysicalKeyCode::Numpad0, + winit::keyboard::KeyCode::Numpad1 => PhysicalKeyCode::Numpad1, + winit::keyboard::KeyCode::Numpad2 => PhysicalKeyCode::Numpad2, + winit::keyboard::KeyCode::Numpad3 => PhysicalKeyCode::Numpad3, + winit::keyboard::KeyCode::Numpad4 => PhysicalKeyCode::Numpad4, + winit::keyboard::KeyCode::Numpad5 => PhysicalKeyCode::Numpad5, + winit::keyboard::KeyCode::Numpad6 => PhysicalKeyCode::Numpad6, + winit::keyboard::KeyCode::Numpad7 => PhysicalKeyCode::Numpad7, + winit::keyboard::KeyCode::Numpad8 => PhysicalKeyCode::Numpad8, + winit::keyboard::KeyCode::Numpad9 => PhysicalKeyCode::Numpad9, + winit::keyboard::KeyCode::NumpadAdd => PhysicalKeyCode::NumpadAdd, + winit::keyboard::KeyCode::NumpadBackspace => PhysicalKeyCode::NumpadBackspace, + winit::keyboard::KeyCode::NumpadClear => PhysicalKeyCode::NumpadClear, + winit::keyboard::KeyCode::NumpadClearEntry => PhysicalKeyCode::NumpadClearEntry, + winit::keyboard::KeyCode::NumpadComma => PhysicalKeyCode::NumpadComma, + winit::keyboard::KeyCode::NumpadDecimal => PhysicalKeyCode::NumpadDecimal, + winit::keyboard::KeyCode::NumpadDivide => PhysicalKeyCode::NumpadDivide, + winit::keyboard::KeyCode::NumpadEnter => PhysicalKeyCode::NumpadEnter, + winit::keyboard::KeyCode::NumpadEqual => PhysicalKeyCode::NumpadEqual, + winit::keyboard::KeyCode::NumpadHash => PhysicalKeyCode::NumpadHash, + winit::keyboard::KeyCode::NumpadMemoryAdd => PhysicalKeyCode::NumpadMemoryAdd, + winit::keyboard::KeyCode::NumpadMemoryClear => PhysicalKeyCode::NumpadMemoryClear, + winit::keyboard::KeyCode::NumpadMemoryRecall => PhysicalKeyCode::NumpadMemoryRecall, + winit::keyboard::KeyCode::NumpadMemoryStore => PhysicalKeyCode::NumpadMemoryStore, + winit::keyboard::KeyCode::NumpadMemorySubtract => PhysicalKeyCode::NumpadMemorySubtract, + winit::keyboard::KeyCode::NumpadMultiply => PhysicalKeyCode::NumpadMultiply, + winit::keyboard::KeyCode::NumpadParenLeft => PhysicalKeyCode::NumpadParenLeft, + winit::keyboard::KeyCode::NumpadParenRight => PhysicalKeyCode::NumpadParenRight, + winit::keyboard::KeyCode::NumpadStar => PhysicalKeyCode::NumpadStar, + winit::keyboard::KeyCode::NumpadSubtract => PhysicalKeyCode::NumpadSubtract, + winit::keyboard::KeyCode::Escape => PhysicalKeyCode::Escape, + winit::keyboard::KeyCode::Fn => PhysicalKeyCode::Fn, + winit::keyboard::KeyCode::FnLock => PhysicalKeyCode::FnLock, + winit::keyboard::KeyCode::PrintScreen => PhysicalKeyCode::PrintScreen, + winit::keyboard::KeyCode::ScrollLock => PhysicalKeyCode::ScrollLock, + winit::keyboard::KeyCode::Pause => PhysicalKeyCode::Pause, + winit::keyboard::KeyCode::BrowserBack => PhysicalKeyCode::BrowserBack, + winit::keyboard::KeyCode::BrowserFavorites => PhysicalKeyCode::BrowserFavorites, + winit::keyboard::KeyCode::BrowserForward => PhysicalKeyCode::BrowserForward, + winit::keyboard::KeyCode::BrowserHome => PhysicalKeyCode::BrowserHome, + winit::keyboard::KeyCode::BrowserRefresh => PhysicalKeyCode::BrowserRefresh, + winit::keyboard::KeyCode::BrowserSearch => PhysicalKeyCode::BrowserSearch, + winit::keyboard::KeyCode::BrowserStop => PhysicalKeyCode::BrowserStop, + winit::keyboard::KeyCode::Eject => PhysicalKeyCode::Eject, + winit::keyboard::KeyCode::LaunchApp1 => PhysicalKeyCode::LaunchApp1, + winit::keyboard::KeyCode::LaunchApp2 => PhysicalKeyCode::LaunchApp2, + winit::keyboard::KeyCode::LaunchMail => PhysicalKeyCode::LaunchMail, + winit::keyboard::KeyCode::MediaPlayPause => PhysicalKeyCode::MediaPlayPause, + winit::keyboard::KeyCode::MediaSelect => PhysicalKeyCode::MediaSelect, + winit::keyboard::KeyCode::MediaStop => PhysicalKeyCode::MediaStop, + winit::keyboard::KeyCode::MediaTrackNext => PhysicalKeyCode::MediaTrackNext, + winit::keyboard::KeyCode::MediaTrackPrevious => PhysicalKeyCode::MediaTrackPrevious, + winit::keyboard::KeyCode::Power => PhysicalKeyCode::Power, + winit::keyboard::KeyCode::Sleep => PhysicalKeyCode::Sleep, + winit::keyboard::KeyCode::AudioVolumeDown => PhysicalKeyCode::AudioVolumeDown, + winit::keyboard::KeyCode::AudioVolumeMute => PhysicalKeyCode::AudioVolumeMute, + winit::keyboard::KeyCode::AudioVolumeUp => PhysicalKeyCode::AudioVolumeUp, + winit::keyboard::KeyCode::WakeUp => PhysicalKeyCode::WakeUp, + winit::keyboard::KeyCode::Meta => PhysicalKeyCode::Meta, + winit::keyboard::KeyCode::Hyper => PhysicalKeyCode::Hyper, + winit::keyboard::KeyCode::Turbo => PhysicalKeyCode::Turbo, + winit::keyboard::KeyCode::Abort => PhysicalKeyCode::Abort, + winit::keyboard::KeyCode::Resume => PhysicalKeyCode::Resume, + winit::keyboard::KeyCode::Suspend => PhysicalKeyCode::Suspend, + winit::keyboard::KeyCode::Again => PhysicalKeyCode::Again, + winit::keyboard::KeyCode::Copy => PhysicalKeyCode::Copy, + winit::keyboard::KeyCode::Cut => PhysicalKeyCode::Cut, + winit::keyboard::KeyCode::Find => PhysicalKeyCode::Find, + winit::keyboard::KeyCode::Open => PhysicalKeyCode::Open, + winit::keyboard::KeyCode::Paste => PhysicalKeyCode::Paste, + winit::keyboard::KeyCode::Props => PhysicalKeyCode::Props, + winit::keyboard::KeyCode::Select => PhysicalKeyCode::Select, + winit::keyboard::KeyCode::Undo => PhysicalKeyCode::Undo, + winit::keyboard::KeyCode::Hiragana => PhysicalKeyCode::Hiragana, + winit::keyboard::KeyCode::Katakana => PhysicalKeyCode::Katakana, + winit::keyboard::KeyCode::F1 => PhysicalKeyCode::F1, + winit::keyboard::KeyCode::F2 => PhysicalKeyCode::F2, + winit::keyboard::KeyCode::F3 => PhysicalKeyCode::F3, + winit::keyboard::KeyCode::F4 => PhysicalKeyCode::F4, + winit::keyboard::KeyCode::F5 => PhysicalKeyCode::F5, + winit::keyboard::KeyCode::F6 => PhysicalKeyCode::F6, + winit::keyboard::KeyCode::F7 => PhysicalKeyCode::F7, + winit::keyboard::KeyCode::F8 => PhysicalKeyCode::F8, + winit::keyboard::KeyCode::F9 => PhysicalKeyCode::F9, + winit::keyboard::KeyCode::F10 => PhysicalKeyCode::F10, + winit::keyboard::KeyCode::F11 => PhysicalKeyCode::F11, + winit::keyboard::KeyCode::F12 => PhysicalKeyCode::F12, + winit::keyboard::KeyCode::F13 => PhysicalKeyCode::F13, + winit::keyboard::KeyCode::F14 => PhysicalKeyCode::F14, + winit::keyboard::KeyCode::F15 => PhysicalKeyCode::F15, + winit::keyboard::KeyCode::F16 => PhysicalKeyCode::F16, + winit::keyboard::KeyCode::F17 => PhysicalKeyCode::F17, + winit::keyboard::KeyCode::F18 => PhysicalKeyCode::F18, + winit::keyboard::KeyCode::F19 => PhysicalKeyCode::F19, + winit::keyboard::KeyCode::F20 => PhysicalKeyCode::F20, + winit::keyboard::KeyCode::F21 => PhysicalKeyCode::F21, + winit::keyboard::KeyCode::F22 => PhysicalKeyCode::F22, + winit::keyboard::KeyCode::F23 => PhysicalKeyCode::F23, + winit::keyboard::KeyCode::F24 => PhysicalKeyCode::F24, + winit::keyboard::KeyCode::F25 => PhysicalKeyCode::F25, + winit::keyboard::KeyCode::F26 => PhysicalKeyCode::F26, + winit::keyboard::KeyCode::F27 => PhysicalKeyCode::F27, + winit::keyboard::KeyCode::F28 => PhysicalKeyCode::F28, + winit::keyboard::KeyCode::F29 => PhysicalKeyCode::F29, + winit::keyboard::KeyCode::F30 => PhysicalKeyCode::F30, + winit::keyboard::KeyCode::F31 => PhysicalKeyCode::F31, + winit::keyboard::KeyCode::F32 => PhysicalKeyCode::F32, + winit::keyboard::KeyCode::F33 => PhysicalKeyCode::F33, + winit::keyboard::KeyCode::F34 => PhysicalKeyCode::F34, + winit::keyboard::KeyCode::F35 => PhysicalKeyCode::F35, + _ => PhysicalKeyCode::Unidentified(NativeKeyCode::Unidentified), }, } } diff --git a/examples/2d/2d_gizmos.rs b/examples/2d/2d_gizmos.rs index 1e7129f51949f7..2674a4b7971573 100644 --- a/examples/2d/2d_gizmos.rs +++ b/examples/2d/2d_gizmos.rs @@ -218,45 +218,45 @@ fn draw_primitives( fn update_config( mut config_store: ResMut, - keyboard: Res>, + keyboard: Res>, time: Res