From a6e97019bd53e4478c846f8f636c18ecb53bece2 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Tue, 10 Oct 2023 14:56:04 +1300 Subject: First commit, before upgrading winit to version 28.1 --- src/keyboard_input.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/keyboard_input.rs (limited to 'src/keyboard_input.rs') 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, + pub scancode: u32, +} + +impl From for KeyboardInput { + fn from(input: WinitKeyboardInput) -> Self { + Self { + state: input.state.into(), + keycode: input.virtual_keycode, + scancode: input.scancode, + } + } +} -- cgit v1.2.3-70-g09d2