InputState

Trait InputState 

Source
pub trait InputState: KeyboardState {
    // Required methods
    fn begin(&mut self) -> Result<()>;
    fn next_loop(&mut self) -> Result<NextLoopState>;
    fn finish(&mut self) -> Result<()>;
}
Expand description

Trait for managing input state in a game loop.

This trait extends KeyboardState and provides methods for managing input state throughout the lifecycle of a game loop.

Its methods provide a way for different platform implementations to hook into the game loop cycle to handle input event processing.

Required Methods§

Source

fn begin(&mut self) -> Result<()>

Initializes the input state before starting a loop.

This method is called once before entering the main loop.

Source

fn next_loop(&mut self) -> Result<NextLoopState>

Updates the input state for the next frame.

This method is called at the beginning of each loop iteration, before the update function is invoked.

Source

fn finish(&mut self) -> Result<()>

Finalizes the input state after the loop ends.

This method is called once after exiting the main loop.

Implementors§