InputStateTracker
Tracks every button each player is holding, from GameInput press/release events.
Constructor
new InputStateTracker(): InputStateTrackerInstance Methods
onInput(input: BGE.GameInput): void
Parameters
input(BGE.GameInput)
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 framecontrols(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