From c140b9df9007490e31844f5e0710395387118100 Mon Sep 17 00:00:00 2001 From: Huon Imberger Date: Sun, 26 May 2024 13:36:34 +1000 Subject: [PATCH] Revert move for cleaner diff --- comfy/src/game_loop.rs | 52 +++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/comfy/src/game_loop.rs b/comfy/src/game_loop.rs index 364d5bc..da8c840 100644 --- a/comfy/src/game_loop.rs +++ b/comfy/src/game_loop.rs @@ -222,32 +222,6 @@ pub async fn run_comfy_main_async( } match event { - WindowEvent::KeyboardInput {event, ..} => { - if let Some(keycode) = - KeyCode::try_from_winit(event.physical_key) - { - match event.state { - ElementState::Pressed => { - let mut state = - GLOBAL_STATE.borrow_mut(); - - state.pressed.insert(keycode); - state.just_pressed.insert(keycode); - state.just_released.remove(&keycode); - } - - ElementState::Released => { - let mut state = - GLOBAL_STATE.borrow_mut(); - - state.pressed.remove(&keycode); - state.just_pressed.remove(&keycode); - state.just_released.insert(keycode); - } - } - } - } - WindowEvent::CursorMoved { position, .. } => { let mut global_state = GLOBAL_STATE.borrow_mut(); @@ -325,6 +299,32 @@ pub async fn run_comfy_main_async( } } + WindowEvent::KeyboardInput {event, ..} => { + if let Some(keycode) = + KeyCode::try_from_winit(event.physical_key) + { + match event.state { + ElementState::Pressed => { + let mut state = + GLOBAL_STATE.borrow_mut(); + + state.pressed.insert(keycode); + state.just_pressed.insert(keycode); + state.just_released.remove(&keycode); + } + + ElementState::Released => { + let mut state = + GLOBAL_STATE.borrow_mut(); + + state.pressed.remove(&keycode); + state.just_pressed.remove(&keycode); + state.just_released.insert(keycode); + } + } + } + } + WindowEvent::Resized(physical_size) => { if physical_size.width > min_resolution.0 && physical_size.height > min_resolution.1