InputStateTracker

Tracks every button each player is holding, from GameInput press/release events.


Constructor

new InputStateTracker(): InputStateTracker

Instance Methods

onInput(input: BGE.GameInput): void

Parameters

Returns

  • void

update(dt: float, controls?: BGE.Controller.ControlMap): void

Advances the clock and reads every known player's sticks.

Parameters

  • dt (float) — seconds since last frame
  • controls (BGE.Controller.ControlMap, optional, default: "invalid") — stick source; sticks stay neutral without one

Returns

  • void

getPlayers(): Array.<BGE.Debug.InputPlayerState>

Returns

  • Array.<BGE.Debug.InputPlayerState>

getHeldSeconds( state: BGE.Debug.InputPlayerState, buttonName: string, ): float

Parameters

  • state (BGE.Debug.InputPlayerState)
  • buttonName (string) — lowercased button name

Returns

  • float

describeHeld( state: BGE.Debug.InputPlayerState, maxShown?: integer, ): string

Held buttons with their held times, longest-held first so a quick tap doesn't push out a long hold.

Parameters

  • state (BGE.Debug.InputPlayerState)
  • maxShown (integer, optional, default: -1) — most buttons to list, -1 for all

Returns

  • string

describePlayer(state: BGE.Debug.InputPlayerState): string

One line summing up a player, for the text mode of BGE.Debug.InputDisplay.

Parameters

  • state (BGE.Debug.InputPlayerState)

Returns

  • string