#[derive(Default)]
pub struct Keyboard {
    pub keystates: std::collections::HashMap<winit::keyboard::KeyCode, winit::event::ElementState>,
    pub frame_chars: Vec<char>,
    pub frame_keys: Vec<(winit::keyboard::KeyCode, bool)>,
}

impl Keyboard {
    pub fn is_key_pressed(&self, keycode: winit::keyboard::KeyCode) -> bool {
        self.keystates
            .get(&keycode)
            .is_some_and(|state| *state == winit::event::ElementState::Pressed)
    }

    pub fn clear_frame_input(&mut self) {
        self.frame_chars.clear();
        self.frame_keys.clear();
    }
}
