Class: Keyboard

controller/Keyboard~ Keyboard

new Keyboard()

Keyboard helper
Source:

Members

keys :Array

Each index correspond to the ascii value of the key pressed
Type:
  • Array
Source:

Methods

get(key) → {boolean}

Gets the pressed state of the key `key`
Parameters:
Name Type Description
key string
Source:
Returns:
Type
boolean

init()

Adds the keydown and keyup listeners
Source:

onKeyDown() → {function}

Sets `event.keycode` as a preseed key
Source:
Returns:
Type
function

onKeyUp() → {function}

Sets `event.keycode` as an unpressed key
Source:
Returns:
Type
function

set(key, value)

Sets the pressed state of the key `key` to `value`
Parameters:
Name Type Description
key string
value boolean
Source: