feat: added a camera with orthographic projection and did some work restructuring the comet_app to make the setup system optional. Input handling is moved to the app

This commit is contained in:
lisk77 2024-11-13 03:33:02 +01:00
parent 780365aeb8
commit 5a9f632e3a
22 changed files with 1173 additions and 349 deletions

View file

@ -1,5 +1,5 @@
use winit::event::{ElementState, KeyEvent, WindowEvent};
use winit::keyboard::{ KeyCode, PhysicalKey};
use winit::keyboard::{ KeyCode, PhysicalKey };
pub type Key = KeyCode;
@ -29,4 +29,18 @@ pub fn key_released(event: &WindowEvent, key_code: Key) -> bool {
} => *code == key_code,
_ => false,
}
}
pub fn key_press(event: &WindowEvent, key_code: Key) -> bool {
match event {
WindowEvent::KeyboardInput {
event: KeyEvent {
state: ElementState::Pressed,
physical_key: PhysicalKey::Code(code),
..
},
..
} => *code == key_code,
_ => false,
}
}