@fogrexon/glyph-arena-gamepad

Gamepad state snapshot reader. See also package README.

Exports

Generated from the package's source when the docs are built — do not edit this table by hand.

NameKind
CreateGamepadOptionstype
GamepadReadertype
GamepadStatetype
createGamepadfunction

createGamepad(options?)

const gamepad = createGamepad({ getGamepads? });

const pads = gamepad.snapshot();
gamepad.dispose();

Options

Methods

GamepadState

FieldTypeDescription
indexnumbergamepad index
idstringgamepad id string
buttonsreadonly boolean[]pressed state per button
axesreadonly number[]raw axis values (no deadzone)

Button and axis arrays are copied so caller mutation does not affect the next snapshot.

Errors

When getGamepads throws, snapshot() propagates the error.