pub fn keyboard_event(&mut self, is_down: bool, e: KeyboardEvent) {
        let key = match e.key().as_str() {
            "a" | "ArrowLeft" => Key::Left,
            "d" | "ArrowRight" => Key::Right,
            " " => Key::Shoot,
            _ => return,
        };
        let event = if is_down {
            KeyEvent::Down(key)
        } else {
            KeyEvent::Up(key)
        };
        self.event_queue.push(event);
    }
/// Add keyboard event to event queue. Matches on the DOM **KeyboardEvent** to extract all
/// relevant keys, transforms them into the **Key** enum, and finally adds them to the queue (as a KeyEvent)
Add keyboard event to event queue.
Add keyboard event to event queue .
pub fn keyboard_event(&mut self, is_down: bool, e: KeyboardEvent) {
        let key = match e.key().as_str() {
            "a" | "ArrowLeft" => Key::Left,
            "d" | "ArrowRight" => Key::Right,
            " " => Key::Shoot,
            _ => return,
        };
        let event = if is_down {
            KeyEvent::Down(key)
        } else {
            KeyEvent::Up(key)
        };
        self.event_queue.push(event);
    }
pub fn keyboard_event ( & mut self , is_down : bool , e : KeyboardEvent ) { let key = match e . key ( ) . as_str ( ) { " " | " " => Key :: Left , " " | " " => Key :: Right , " " => Key :: Shoot , _ => return , } ; let event = if is_down { KeyEvent :: Down ( key ) } else { KeyEvent :: Up ( key ) } ; self . event_queue . push ( event ) ; }
Add keyboard event to event queue.
Add keyboard event to event queue .
&mut self
is_down
bool
e
KeyboardEvent
&mut self
is_down
bool
e
KeyboardEvent