Did stuff.

This commit is contained in:
2017-02-03 10:00:07 +01:00
parent 8178b415ae
commit ec42cb33e0
13 changed files with 277 additions and 111 deletions

View File

@@ -20,14 +20,14 @@ impl KeyboardHandler {
pub fn process(&mut self, event: &Event) {
match *event {
Event::KeyDown {keycode, repeat, ..} => {
Event::KeyDown { keycode, repeat, .. } => {
if !repeat {
self.key_down(keycode.unwrap());
}
},
Event::KeyUp {keycode, ..} => {
}
Event::KeyUp { keycode, .. } => {
self.key_up(keycode.unwrap());
},
}
_ => (),
}
}
@@ -50,21 +50,21 @@ impl KeyboardHandler {
pub fn was_pressed(&self, keycode: Keycode) -> bool {
match self.pressed_keys.get(&keycode) {
Some(state) => *state,
None => false
None => false,
}
}
pub fn was_released(&self, keycode: Keycode) -> bool {
match self.released_keys.get(&keycode) {
Some(state) => *state,
None => false
None => false,
}
}
pub fn is_held(&self, keycode: Keycode) -> bool {
match self.held_keys.get(&keycode) {
Some(state) => *state,
None => false
None => false,
}
}
}