start input
This commit is contained in:
25
src/input.rs
Normal file
25
src/input.rs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
|
use evdev::{AbsoluteAxisCode, Device, EventSummary, KeyCode};
|
||||||
|
|
||||||
|
struct InputState {
|
||||||
|
x: i32,
|
||||||
|
y: i32,
|
||||||
|
keys_down: HashSet<KeyCode>,
|
||||||
|
keys_pressed_this_update: HashSet<KeyCode>,
|
||||||
|
keys_released_this_update: HashSet<KeyCode>,
|
||||||
|
clear_before_next_event: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl InputState {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
keys_down: HashSet::new(),
|
||||||
|
keys_pressed_this_update: HashSet::new(),
|
||||||
|
keys_released_this_update: HashSet::new(),
|
||||||
|
clear_before_next_event: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user