use winit::event::{ElementState, VirtualKeyCode}; pub struct InputStatus { pub key_left: bool, pub key_right: bool, pub key_thrust: bool, } impl InputStatus { pub fn new() -> Self { InputStatus { key_left: false, key_right: false, key_thrust: false, } } pub fn process(&mut self, state: &ElementState, key: &VirtualKeyCode) { let down = state == &ElementState::Pressed; match key { VirtualKeyCode::Left => self.key_left = down, VirtualKeyCode::Right => self.key_right = down, VirtualKeyCode::Up => self.key_thrust = down, _ => {} } } }