Key State

Each individual Window keeps a record of each key's state - this state can either be "press" or "release." Each window maintains its own record because windows only receive information from the keyboard when they have input focus. Therefore multiple windows can have different interpretations of the full keyboard's state.

key_pressed?

You can find out whether or not a specific Window thinks a Key is currently pressed or released using the key_pressed? method:

key = event.key # => CrystGLFW::Key
window.key_pressed?(key) # => Bool

key_pressed? returns true if the Window thinks that the Key is currently pressed, and returns false if the Window thinks that the Key is currently released. The return value of this method is affected by sticky keys.

results matching ""

    No results matching ""