diff options
Diffstat (limited to 'src/keyboard_input.rs')
-rw-r--r-- | src/keyboard_input.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/keyboard_input.rs b/src/keyboard_input.rs new file mode 100644 index 0000000..139db7e --- /dev/null +++ b/src/keyboard_input.rs @@ -0,0 +1,19 @@ +use crate::*; +use winit::event::KeyboardInput as WinitKeyboardInput; + +#[derive(Copy, Clone)] +pub struct KeyboardInput { + pub state: PressState, + pub keycode: Option<KeyCode>, + pub scancode: u32, +} + +impl From<WinitKeyboardInput> for KeyboardInput { + fn from(input: WinitKeyboardInput) -> Self { + Self { + state: input.state.into(), + keycode: input.virtual_keycode, + scancode: input.scancode, + } + } +} |