Module input

Module input 

Source
Expand description

Contains Both the MouseKey and Key Enums for input

impl Game For Struct {
    fn update(&mut self, engine_handle: &mut Engine) {
        if engine_handle.is_key_down(Key::W) {
            // do something
        }

        if engine.check_modifiers(ModifierKeys::Ctrl) && engine.is_key_pressed(Key::S) {
            // wow ctrl + s better save
        }

        if engine_handle.is_mouse_key_down(MouseKey::Left) {
            // do more things
        }
    }
}

Enums§

Key
Representation of keyboard keys
ModifierKeys
Keys such as Shift Ctrl and Alt that can be used to “modify inputs” think about shortcuts like Ctrl + S to save on most text editors. Note that these do not diffrentiate between sides so LeftShift will be considered the same as RightShift for modifiers. To get specific keys use Key
MouseKey
Representation of mouse buttons