Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface InputStatic

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

class

Input

Hierarchy

  • InputStatic

Index

Properties

_currentState

_currentState: object

Type declaration

  • [key: string]: boolean

_date

_date: number

_dir4

_dir4: number

_dir8

_dir8: number

_gamepadStates

_gamepadStates: Array<Array<boolean>>

_latestButton

_latestButton: string

_preferredAxis

_preferredAxis: string

_pressedTime

_pressedTime: number

_previousState

_previousState: object

Type declaration

  • [key: string]: boolean

date

date: number

[read-only] The time of the last input in milliseconds.

static
property

date

type

Number

dir4

dir4: number

[read-only] The four direction value as a number of the numpad, or 0 for neutral.

static
property

dir4

type

Number

dir8

dir8: number

[read-only] The eight direction value as a number of the numpad, or 0 for neutral.

static
property

dir8

type

Number

gamepadMapper

gamepadMapper: object

A hash table to convert from a gamepad button to a mapped key name.

static
property

gamepadMapper

type

Object

Type declaration

  • [key: number]: string

keyMapper

keyMapper: object

A hash table to convert from a virtual key code to a mapped key name.

static
property

keyMapper

type

Object

Type declaration

  • [key: number]: string

keyRepeatInterval

keyRepeatInterval: number

The interval of the key repeat in frames.

static
property

keyRepeatInterval

type

Number

keyRepeatWait

keyRepeatWait: number

The wait time of the key repeat in frames.

static
property

keyRepeatWait

type

Number

Methods

Private _isEscapeCompatible

  • _isEscapeCompatible(keyName: string): boolean

Private _makeNumpadDirection

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

Private _onKeyDown

  • _onKeyDown(event: KeyboardEvent): void

Private _onKeyUp

  • _onKeyUp(event: KeyboardEvent): void

Private _onLostFocus

  • _onLostFocus(): void

Private _pollGamepads

  • _pollGamepads(): void

Private _setupEventHandlers

  • _setupEventHandlers(): void

Private _shouldPreventDefault

  • _shouldPreventDefault(keyCode: number): boolean

Private _signX

  • _signX(): number

Private _signY

  • _signY(): number

Private _updateDirection

  • _updateDirection(): void

Private _updateGamepadState

  • _updateGamepadState(gamepad: Gamepad): void

Private _wrapNwjsAlert

  • _wrapNwjsAlert(): void

clear

  • clear(): void

initialize

  • initialize(): void

isLongPressed

  • isLongPressed(keyName: string): boolean
  • Checks whether a key is kept depressed.

    static
    method

    isLongPressed

    Parameters

    • keyName: string

      The mapped name of the key

    Returns boolean

    True if the key is long-pressed

isPressed

  • isPressed(keyName: string): boolean
  • Checks whether a key is currently pressed down.

    static
    method

    isPressed

    Parameters

    • keyName: string

      The mapped name of the key

    Returns boolean

    True if the key is pressed

isRepeated

  • isRepeated(keyName: string): boolean
  • Checks whether a key is just pressed or a key repeat occurred.

    static
    method

    isRepeated

    Parameters

    • keyName: string

      The mapped name of the key

    Returns boolean

    True if the key is repeated

isTriggered

  • isTriggered(keyName: string): boolean
  • Checks whether a key is just pressed.

    static
    method

    isTriggered

    Parameters

    • keyName: string

      The mapped name of the key

    Returns boolean

    True if the key is triggered

update

  • update(): void

Generated using TypeDoc