fn update_key(&self, key: KeyCode, state: ButtonState) {
        let mut b = self.buttons.get();

        match key {
            KeyCode::Up        => b.up     = state,
            KeyCode::Down      => b.down   = state,
            KeyCode::Left      => b.left   = state,
            KeyCode::Right     => b.right  = state,
            KeyCode::LAlt      => b.a      = state,
            KeyCode::LCtrl     => b.b      = state,
            KeyCode::Return    => b.start  = state,
            KeyCode::RShift    => b.select = state,
            _                  => (),
        }

        self.buttons.set(b);
    }
/// Update key state. For now keybindings are hardcoded.
Update key state. For now keybindings are hardcoded.
Update key state . For now keybindings are hardcoded .
fn update_key(&self, key: KeyCode, state: ButtonState) {
        let mut b = self.buttons.get();
        match key {
            KeyCode::Up        => b.up     = state,
            KeyCode::Down      => b.down   = state,
            KeyCode::Left      => b.left   = state,
            KeyCode::Right     => b.right  = state,
            KeyCode::LAlt      => b.a      = state,
            KeyCode::LCtrl     => b.b      = state,
            KeyCode::Return    => b.start  = state,
            KeyCode::RShift    => b.select = state,
            _                  => (),
        }
        self.buttons.set(b);
    }
fn update_key ( & self , key : KeyCode , state : ButtonState ) { let mut b = self . buttons . get ( ) ; match key { KeyCode :: Up => b . up = state , KeyCode :: Down => b . down = state , KeyCode :: Left => b . left = state , KeyCode :: Right => b . right = state , KeyCode :: LAlt => b . a = state , KeyCode :: LCtrl => b . b = state , KeyCode :: Return => b . start = state , KeyCode :: RShift => b . select = state , _ => ( ) , } self . buttons . set ( b ) ; }
Update key state.
Update key state .
&self
key
KeyCode
state
ButtonState
&self
key
KeyCode
state
ButtonState