struct Espresso::KeyboardKeyEvent

Overview

Event triggered when a physical keyboard key is pressed or released.

Defined in:

espresso/events/keyboard_key_event.cr

Instance Method Summary

Instance methods inherited from struct Espresso::KeyboardEvent

keyboard : Keyboard keyboard

Instance methods inherited from struct Espresso::WindowEvent

window : Window window

Instance Method Detail

def key : Key #

Keyboard key that is pressed or released.


[View source]
def key_name? #

Retrieves the name of the key, encoded as UTF-8. If the key is printable, a string will be returned, nil otherwise.


[View source]
def mods : ModifierKey #

Any modifier keys that were held down when the event occurred.


[View source]
def pressed? #

Indicates whether the key was pressed.


[View source]
def released? #

Indicates whether the key was released.


[View source]
def scancode : Int32 #

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.


[View source]
def state : KeyState #

State of the key.


[View source]