ControllerRegistry
Constructor
new ControllerRegistry(): ControllerRegistryInstance Methods
assignPlayerIndex(): integer
Assigns the lowest player index not currently in use.
Returns
integer
releasePlayerIndex(playerIndex: integer): void
Frees a player index previously returned by assignPlayerIndex(), e.g. when its connection closes - a later assignPlayerIndex() call may reuse it.
Parameters
playerIndex(integer) — the player index to release
Returns
void
updateFromMessage(
playerIndex: integer,
buttons: object,
sticks: object,
custom: object,
): dynamic
Updates one connection's raw state from a decoded {buttons, sticks, custom} message. Returns the button names whose boolean flipped since the last update, for Game to synthesize press/release GameInput events. The message is untrusted - a non-boolean button or non-numeric stick axis is coerced to a safe default (false / 0.0) rather than propagating whatever ParseJson happened to hand back.
Parameters
playerIndex(integer)buttons(object) — name -> dynamic (expected boolean)sticks(object) — name -> {x, y} (each dynamic, expected numeric)custom(object) — opaque, passed through untouched
Returns
dynamic
isButtonHeld(playerIndex: integer, buttonName: string): boolean
last message, false if it wasn't (or the name/player is unknown)
Parameters
playerIndex(integer) — which player's connection to readbuttonName(string) — which button to check
Returns
boolean
getHeldTimeMs(playerIndex: integer, buttonName: string): integer
continuously held, 0 if it's not currently held (or never was)
Parameters
playerIndex(integer) — which player's connection to readbuttonName(string) — which button to check
Returns
integer
getButtonNames(playerIndex: integer): dynamic
player (empty if never seen), so Game can scan without assuming a fixed set.
Parameters
playerIndex(integer)
Returns
dynamic
getStick(
playerIndex: integer,
stickName: string,
): BGE.Math.Vector
never reported or the player is unknown
Parameters
playerIndex(integer) — which player's connection to readstickName(string) — the stick's name, as sent in the message'ssticksmap
Returns
BGE.Math.Vector
getCustomPayload(playerIndex: integer): object
never sent or the player is unknown
Parameters
playerIndex(integer)
Returns
object
setRemoteDpad(x: float, y: float): void
Records the remote control's own d-pad fallback state, used by BGE.Controller.ControlMap.getAxis() when no controller is bound.
Parameters
x(float) — 1..1y(float) — 1..1
Returns
void
getRemoteDpad(): BGE.Math.Vector
last set by setRemoteDpad()
Returns
BGE.Math.Vector