Struct gg::event::Keys
[−]
[src]
pub struct Keys { // some fields omitted }
Holds state about the currently pressed buttons as well as buttons that just have been pressed and those that are released. Sequence is as follows: 1. Released 2. Press 3. Pressed 4. Release 5. goto: 1
Per default all keys are 'Released'
Methods
impl Keys
fn status(&self, key: KeyCode) -> KeyState
Gives you the KeyState of a given Key
fn held(&self, key: KeyCode) -> bool
A quick way to check if a given key is pressed or held
fn pressed(&self, key: KeyCode) -> bool
A quick way to check if a given key has just been pressed
fn not_pressed(&self, key: KeyCode) -> bool
A quick way to check if a given key is released
fn new() -> Keys
Creates a new keys struct
fn update_key(&mut self, key: KeyCode, state: ElementState, time: f64)
Update a given key with a given state
fn update(&mut self, time: f64)
Update all the keys and advance them to the next step