Class Keyboard

Keyboard instance for input in sync with the running application.

Hierarchy (view full)

Constructors

Properties

actions: any[] = []

Key press actions. Key actions are stored in pairs.

The size of the actions array is expected to be even.

domElement: HTMLElement | Window = null

DOM element where the keyboard events are attached.

events: EventManager = null

Event manager object to create and manage the key press events.

keys: any[] = []

Keys pressed.

Methods

  • Check is a key as just pressed.

    Parameters

    • key: number

      Which key to check.

    Returns boolean

  • Check if a key was just released.

    Parameters

    • key: number

      Which key to check.

    Returns boolean

  • Check if a key is pressed.

    Parameters

    • key: number

      Which key to check.

    Returns boolean

  • Reset keyboard status to default.

    Does not clean the action list.

    Returns void

  • Update key flags synchronously.

    Returns void