struct Espresso::KeyboardKeyEvent
Overview
Event triggered when a physical keyboard key is pressed or released.
Defined in:
espresso/events/keyboard_key_event.crInstance Method Summary
-
#key : Key
Keyboard key that is pressed or released.
-
#key_name?
Retrieves the name of the key, encoded as UTF-8.
-
#mods : ModifierKey
Any modifier keys that were held down when the event occurred.
-
#pressed?
Indicates whether the key was pressed.
-
#released?
Indicates whether the key was released.
-
#scancode : Int32
The scancode of a key is specific to that platform or sometimes even to that machine.
-
#state : KeyState
State of the key.
Instance methods inherited from struct Espresso::KeyboardEvent
keyboard : Keyboard
keyboard
Instance methods inherited from struct Espresso::WindowEvent
window : Window
window
Instance Method Detail
Retrieves the name of the key, encoded as UTF-8. If the key is printable, a string will be returned, nil otherwise.
The scancode of a key is specific to that platform
or sometimes even to that machine.
Scancodes are intended to allow users to bind keys
that don't have a GLFW Key
token.
Such keys have #key
set to Key::Unknown
,
their state is not saved
and so it cannot be queried with Keyboard#key
.
Sometimes GLFW needs to generate synthetic key events, in which case the scancode may be zero.