InputEventKey

Inherits: InputEventWithModifiers < InputEvent < Resource < Reference < Object

Input event type for keyboard events.

Description

Stores key presses on the keyboard. Supports key presses, key releases and echo events.

Tutorials

Properties

bool

echo

false

int

physical_scancode

0

bool

pressed

false

int

scancode

0

int

unicode

0

Methods

int

get_physical_scancode_with_modifiers ( ) const

int

get_scancode_with_modifiers ( ) const


Property Descriptions

bool echo = false

  • void set_echo ( bool value )

  • bool is_echo ( )

If true, the key was already pressed before this event. It means the user is holding the key down.


int physical_scancode = 0

  • void set_physical_scancode ( int value )

  • int get_physical_scancode ( )

Key physical scancode, which corresponds to one of the KeyList constants. Represent the physical location of a key on the 101/102-key US QWERTY keyboard.

To get a human-readable representation of the InputEventKey, use OS.get_scancode_string(event.physical_scancode) where event is the InputEventKey.


bool pressed = false

  • void set_pressed ( bool value )

  • bool is_pressed ( )

If true, the key's state is pressed. If false, the key's state is released.


int scancode = 0

  • void set_scancode ( int value )

  • int get_scancode ( )

The key scancode, which corresponds to one of the KeyList constants. Represent key in the current keyboard layout.

To get a human-readable representation of the InputEventKey, use OS.get_scancode_string(event.scancode) where event is the InputEventKey.


int unicode = 0

  • void set_unicode ( int value )

  • int get_unicode ( )

The key Unicode identifier (when relevant). Unicode identifiers for the composite characters and complex scripts may not be available unless IME input mode is active. See OS.set_ime_active for more information.


Method Descriptions

int get_physical_scancode_with_modifiers ( ) const

Returns the physical scancode combined with modifier keys such as Shift or Alt. See also InputEventWithModifiers.

To get a human-readable representation of the InputEventKey with modifiers, use OS.get_scancode_string(event.get_physical_scancode_with_modifiers()) where event is the InputEventKey.


int get_scancode_with_modifiers ( ) const

Returns the scancode combined with modifier keys such as Shift or Alt. See also InputEventWithModifiers.

To get a human-readable representation of the InputEventKey with modifiers, use OS.get_scancode_string(event.get_scancode_with_modifiers()) where event is the InputEventKey.