mirror of
https://github.com/lisk77/comet.git
synced 2025-10-26 06:38:50 +00:00
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:
parent
780365aeb8
commit
5a9f632e3a
22 changed files with 1173 additions and 349 deletions
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue