Skip to content

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.

new GamepadProvider(options?): GamepadProvider

Defined in: src/modules/input/gamepad-provider.ts:140

GamepadProviderOptions = {}

GamepadProvider

dispose(): void

Defined in: src/modules/input/gamepad-provider.ts:167

void

InputProvider.dispose


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.

void


subscribe(handler): () => void

Defined in: src/modules/input/gamepad-provider.ts:202

(raw) => void

() => void

InputProvider.subscribe