API Docs for: 0.1.0
Show:

zerk.game.engine.system.control.keyboard Class

Keyboard Interface

Provides methods to handle keyboard inputs.

Methods

_onKeyDown

(
  • event
)
protected

Key down event handler

Parameters:

  • event DOMEvent

    DOM event

_onKeyPress

(
  • event
)
protected

Key press event handler

Parameters:

  • event DOMEvent

    DOM event

_onKeyUp

(
  • event
)
protected

Key up event handler

Parameters:

  • event DOMEvent

    DOM event

fireEvent

(
  • event
)
Boolen

Fire event

Parameters:

  • event String

    Event name

Returns:

Boolen: Returns false when the bubble was canceled

init

(
  • engine
)

Class constructor

Parameters:

on

(
  • event
  • callback
  • scope
)

Register event handler

Parameters:

  • event String

    Event name

  • callback Function

    Callback function. Return false to cancel event bubble.

  • scope Object

    Scope to be used in callback function

un

(
  • event
  • callback
)
Boolen

Unregister event handler

Parameters:

  • event String

    Event name

  • callback Function

    Callback function

Returns:

Boolen: Returns true on success

Properties

_eventListeners

Array protected

List of event handlers

_keyMap

Object protected

Key map

pressedAlt

Boolean

State of the alt key

pressedArrowDown

Boolean

State of the arrow down key

pressedArrowLeft

Boolean

State of the arrow left key

pressedArrowRight

Boolean

State of the arrow right key

pressedArrowUp

Boolean

State of the arrow up key

pressedBackspace

Boolean

State of the backspace key

pressedCapsLock

Boolean

State of the capslock key

pressedCtrl

Boolean

State of the ctrl key

pressedEnd

Boolean

State of the end key

pressedEnter

Boolean

State of the enter key

pressedEscape

Boolean

State of the escape key

pressedHome

Boolean

State of the home key

pressedPageDown

Boolean

State of the pagedown key

pressedPageUp

Boolean

State of the pageup key

pressedPause

Boolean

State of the pause key

pressedShift

Boolean

State of the shift key

pressedSpace

Boolean

State of the space key

pressedTab

Boolean

State of the tab key

Events

keypress

Fires when a key is pressed

Event Payload:

  • event DOMEvent

keyup

Fires when a key is released

Event Payload:

  • event DOMEvent