pub fn update(&mut self, mouse_state: MouseState) {
        self.mouse = mouse_state;

        // update the mouse buttons depending upon what they were like last frame
        self.keys = self
            .keys
            .iter()
            .map(|(scan, state)| {
                let new_state = match state {
                    // Keys that were pressed down last frame are now held down
                    KeyState::Down => KeyState::Hold,

                    // Keys that were released last frame are now not pressed
                    KeyState::Up => KeyState::None,

                    // Other keys do not change
                    a => *a,
                };
                (*scan, new_state)
            })
            .collect();
    }
/// updates the state for a new frame
updates the state for a new frame
updates the state for a new frame
pub fn update(&mut self, mouse_state: MouseState) {
        self.mouse = mouse_state;
        // update the mouse buttons depending upon what they were like last frame
        self.keys = self
            .keys
            .iter()
            .map(|(scan, state)| {
                let new_state = match state {
                    // Keys that were pressed down last frame are now held down
                    KeyState::Down => KeyState::Hold,
                    // Keys that were released last frame are now not pressed
                    KeyState::Up => KeyState::None,
                    // Other keys do not change
                    a => *a,
                };
                (*scan, new_state)
            })
            .collect();
    }
pub fn update ( & mut self , mouse_state : MouseState ) { self . mouse = mouse_state ; // update the mouse buttons depending upon what they were like last frame self . keys = self . keys . iter ( ) . map ( | ( scan , state ) | { let new_state = match state { // Keys that were pressed down last frame are now held down KeyState :: Down => KeyState :: Hold , // Keys that were released last frame are now not pressed KeyState :: Up => KeyState :: None , // Other keys do not change a => * a , } ; ( * scan , new_state ) } ) . collect ( ) ; }
updates the state for a new frame
updates the state for a new frame
&mut self
mouse_state
MouseState
&mut self
mouse_state
MouseState