Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
Revert move for cleaner diff
Browse files Browse the repository at this point in the history
  • Loading branch information
Plonq committed May 26, 2024
1 parent 350aaf0 commit c140b9d
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions comfy/src/game_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c140b9d

Please sign in to comment.