Class: Keyboard

rune.input.Keyboard(optionsopt)

The Keyboard class represents a physical keyboard with associated keys. With class instances, it is possible to read the state (pressed, released, etc.) for each individual key on the keyboard.

Constructor

new Keyboard(optionsopt)

Creates a new instance of the Keyboard class.
Parameters:
Name Type Attributes Description
options Object <optional>
Keyboard settings.
Source:

Members

(static, constant) NUM_KEYS :number

Number of keys.
Type:
  • number
Source:

enabled :boolean

Whether the keyboard should be activated or not. An inactive (false) keyboard, registers no input.
Type:
  • boolean
Source:

Methods

justPressed(key) → {boolean}

Checks if the specified key was just pressed.
Parameters:
Name Type Description
key string A valid key, such as "SPACE".
Source:
Returns:
Type
boolean

justReleased(key) → {boolean}

Checks if the specified key has just been released.
Parameters:
Name Type Description
key string A valid key, such as "SPACE".
Source:
Returns:
Type
boolean

pressed(key) → {boolean}

Checks if the specified key is pressed.
Parameters:
Name Type Description
key string A valid key, such as "SPACE".
Source:
Returns:
Type
boolean

reset() → {undefined}

Resets the state of all keyboard keys.
Source:
Returns:
Type
undefined