KeyboardInput

KeyboardInput class to handle keyboard input

Example
// Check if the key with the keycode 65 (A) is pressed
KeyboardInput.IsKeyDown(KeyBoardInput.KEY_CODE.A);

Methods

(static) dispose()

Remove global handlers and forget every held key. Safe to call repeatedly.

(static) GetSpecialKeyPressed() → {number}

Returns the keycode of the special key pressed.

Returns:

The keycode of the special key pressed.

Type: 
number

(static) IsKeyDown(keyCode) → {boolean}

Checks if the key with the given keycode is pressed.

Parameters:
NameTypeDescription
keyCodeKeyboardInput.KEY_CODE

The keycode of the key to check.

Returns:

True if the key with the given keycode is pressed.

Type: 
boolean
Example
KeyboardInput.IsKeyDown(KeyboardInput.KEY_CODE.A)

(static) IsKeyPressed()

True for the simulation frame after a key goes down, even after a quick release.

(static) IsKeyReleased()

True for a simulation frame after a key goes up, including a quick tap.

(static) reset()

Clear held and transient state when a gameplay or project context ends.