Link Search Menu Expand Document

Input.d overview


Table of contents


utils

GamepadButtonIndex (type alias)

Signature

export declare type GamepadButtonIndex = keyof typeof Input.gamepadMapper

Input (class)

The static class that handles input data from the keyboard and gamepads.

Signature

export declare class Input {
  constructor()
}

initialize (static method)

Initializes the input system.

Signature

static initialize(): void

clear (static method)

Clears all the input data.

Signature

static clear(): void

update (static method)

Updates the input data.

Signature

static update(): void

isPressed (static method)

Checks whether a key is currently pressed down.

Signature

static isPressed(keyName: string): boolean

isTriggered (static method)

Checks whether a key is just pressed.

Signature

static isTriggered(keyName: string): boolean

isRepeated (static method)

Checks whether a key is just pressed or a key repeat occurred.

Signature

static isRepeated(keyName: string): boolean

isLongPressed (static method)

Checks whether a key is kept depressed.

Signature

static isLongPressed(keyName: string): boolean

date (static method)

The time of the last input in milliseconds.

Signature

static date(): number

virtualClick (static method)

Signature

static virtualClick(buttonName: string): void

_setupEventHandlers (static method)

Signature

static _setupEventHandlers(): void

_onKeyDown (static method)

Signature

static _onKeyDown(event: KeyboardEvent): void

_shouldPreventDefault (static method)

Signature

static _shouldPreventDefault(keyCode: number): boolean

_onKeyUp (static method)

Signature

static _onKeyUp(event: KeyboardEvent): void

_onLostFocus (static method)

Signature

static _onLostFocus(): void

_pollGamepads (static method)

Signature

static _pollGamepads(): void

_updateGamepadState (static method)

Signature

static _updateGamepadState(gamepad: Gamepad): void

_updateDirection (static method)

Signature

static _updateDirection(): void

_signX (static method)

Signature

static _signX(): number

_signY (static method)

Signature

static _signY(): number

_makeNumpadDirection (static method)

Signature

static _makeNumpadDirection(x: number, y: number): number

_isEscapeCompatible (static method)

Signature

static _isEscapeCompatible(keyName: string): boolean

KeyboardButtonIndex (type alias)

Signature

export declare type KeyboardButtonIndex = keyof typeof Input.keyMapper