GamepadProvider
Defined in: src/modules/input/gamepad-provider.ts:133
Web Gamepad API adapter. Unlike the event-driven keyboard/pointer providers,
gamepads are poll-only: the consumer must call GamepadProvider.poll
once per frame/tick. poll() diffs the current digital state (buttons +
deadzoned stick directions) against the previous snapshot and emits raw
down/up edges keyed by Gamepad.* codes — the same contract every other
provider uses, so it drops straight into createInput([keyboard, gamepad]).
State is unioned across all connected controllers (any pad can drive any action), which is the right default for single-player.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new GamepadProvider(
options?):GamepadProvider
Defined in: src/modules/input/gamepad-provider.ts:140
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”GamepadProvider
Methods
Section titled “Methods”dispose()
Section titled “dispose()”dispose():
void
Defined in: src/modules/input/gamepad-provider.ts:167
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”poll()
Section titled “poll()”poll():
void
Defined in: src/modules/input/gamepad-provider.ts:182
Samples every connected controller and emits down/up edges for any
code whose digital state changed since the last call. Call once per
frame. Cheap no-op when nothing is connected.
Returns
Section titled “Returns”void
subscribe()
Section titled “subscribe()”subscribe(
handler): () =>void
Defined in: src/modules/input/gamepad-provider.ts:202
Parameters
Section titled “Parameters”handler
Section titled “handler”(raw) => void
Returns
Section titled “Returns”() => void