Options
All
  • Public
  • Public/Protected
  • All
Menu

Class InputManager

Hierarchy

  • InputManager

Index

Constructors

constructor

  • Handles input for games.

    For keyboards, allows polling of individual key presses, both with and without the keyboard repeat delay.

    Touch and mouse input are currently not supported.

    constructor

    Parameters

    • Optional keyRefireMillis: number

    Returns InputManager

Properties

Private _refireMillis

_refireMillis: any

Private _repeatTimers

_repeatTimers: any

Private keys

keys: any

Methods

_keyDown

  • _keyDown(e: KeyboardEvent): void
  • Parameters

    • e: KeyboardEvent

    Returns void

_keyUp

  • _keyUp(e: KeyboardEvent): void
  • Parameters

    • e: KeyboardEvent

    Returns void

clearKeyState

  • clearKeyState(key: Keys): void
  • Resets a specific key to its "not depressed" state.

    see

    clearKeyStates

    Parameters

    • key: Keys

      The key to reset.

    Returns void

clearKeyStates

  • clearKeyStates(): void
  • Resets all keys to be in their "not depressed" states.

    Returns void

ctrl

  • ctrl(clear?: boolean): boolean
  • Returns whether ctrl is pressed.

    Parameters

    • Optional clear: boolean

      Whether the key's state should be reset to "not pressed" when this method returns. This is useful to effectively enable the keyboard's buffering.

    Returns boolean

    Whether the key was pressed.

down

  • down(clear?: boolean): boolean
  • Returns whether down is pressed.

    Parameters

    • Optional clear: boolean

      Whether the key's state should be reset to "not pressed" when this method returns. This is useful to effectively enable the keyboard's buffering.

    Returns boolean

    Whether the key was pressed.

enter

  • enter(clear?: boolean): boolean
  • Returns whether enter is pressed.

    Parameters

    • Optional clear: boolean

      Whether the key's state should be reset to "not pressed" when this method returns. This is useful to effectively enable the keyboard's buffering.

    Returns boolean

    Whether the key was pressed.

install

  • install(): void
  • Installs this keyboard manager. Should be called during game initialization.

    Returns void

isKeyDown

  • isKeyDown(keyCode: number, clear?: boolean): boolean
  • Returns whether a specific key is pressed.

    Parameters

    • keyCode: number

      A key code.

    • Optional clear: boolean

      Whether the key's state should be reset to "not pressed" when this method returns. This is useful to effectively enable the keyboard's buffering.

    Returns boolean

    Whether the key was pressed.

left

  • left(clear?: boolean): boolean
  • Returns whether left is pressed.

    Parameters

    • Optional clear: boolean

      Whether the key's state should be reset to "not pressed" when this method returns. This is useful to effectively enable the keyboard's buffering.

    Returns boolean

    Whether the key was pressed.

right

  • right(clear?: boolean): boolean
  • Returns whether right is pressed.

    Parameters

    • Optional clear: boolean

      Whether the key's state should be reset to "not pressed" when this method returns. This is useful to effectively enable the keyboard's buffering.

    Returns boolean

    Whether the key was pressed.

shift

  • shift(clear?: boolean): boolean
  • Returns whether shift is pressed.

    Parameters

    • Optional clear: boolean

      Whether the key's state should be reset to "not pressed" when this method returns. This is useful to effectively enable the keyboard's buffering.

    Returns boolean

    Whether the key was pressed.

up

  • up(clear?: boolean): boolean
  • Returns whether up is pressed.

    Parameters

    • Optional clear: boolean

      Whether the key's state should be reset to "not pressed" when this method returns. This is useful to effectively enable the keyboard's buffering.

    Returns boolean

    Whether the key was pressed.

Generated using TypeDoc