aboutsummaryrefslogtreecommitdiff
path: root/src/input/systems.rs
diff options
context:
space:
mode:
authorLibravatar Silas Bartha <silas@exvacuum.dev>2024-12-20 08:07:02 -0500
committerLibravatar Silas Bartha <silas@exvacuum.dev>2024-12-20 08:07:02 -0500
commit6159d531b3ad802e4f4e679e154bfc0887bf4305 (patch)
tree97047155a488a9b84b010f53c6ba5ea2adcf241a /src/input/systems.rs
parent652a17e0f90a045b99a80044be313e23b9529005 (diff)
Re-added vanilla input integration
Diffstat (limited to 'src/input/systems.rs')
-rw-r--r--src/input/systems.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/input/systems.rs b/src/input/systems.rs
index e851977..8add8b2 100644
--- a/src/input/systems.rs
+++ b/src/input/systems.rs
@@ -54,13 +54,22 @@ pub fn input_handling(
if let Some(key_code) = crossterm_keycode_to_bevy_keycode(event.code) {
if let Some(logical_key) = crossterm_keycode_to_bevy_key(event.code) {
match event.kind {
- KeyEventKind::Press | KeyEventKind::Repeat => {
- // input.press(event.code);
+ KeyEventKind::Press => {
key_event_writer.send(KeyboardInput {
key_code,
logical_key,
state: ButtonState::Pressed,
window,
+ repeat: false,
+ });
+ }
+ KeyEventKind::Repeat => {
+ key_event_writer.send(KeyboardInput {
+ key_code,
+ logical_key,
+ state: ButtonState::Pressed,
+ window,
+ repeat: true,
});
}
KeyEventKind::Release => {
@@ -69,6 +78,7 @@ pub fn input_handling(
logical_key,
state: ButtonState::Released,
window,
+ repeat: false,
});
}
}