Skip to main content

Module pad

Module pad 

Source
Expand description

Controllers (ticket 0219, game ADR-0034): from each connected pad’s raw state to the Button presses and releases InputState is fed. Pure: app fills a PadState per pad every frame (gilrs on native, the browser’s Gamepad API on web) and Pads::update does the rest, so both platforms share these rules (docs/design/controls.md, Controller):

  • Sticks are 4-way buttons. A stick pushed far enough counts as one held direction button, the direction it is pushed furthest, so it repeats like a held key and never moves diagonally.
  • Switch-style pads swap Confirm and Cancel. Bindings name button positions; on a PadKind::Nintendo pad the bottom and right face buttons trade places before the keymap sees them.
  • Several pads drive the game as one. A button held on two pads is one press, released when the last pad lets go; unplugging a pad releases what it held.

Structs§

ButtonSet
A set of Buttons.
PadState
One pad’s raw state in one frame, as the platform reports it.
Pads
Every connected pad, merged into one stream of button presses and releases (see the module docs).

Enums§

PadKind
Who made a pad, which decides the Confirm / Cancel swap here and the button names shown on screen (ticket 0220).

Constants§

DIRECTION_SETS
A pad’s three sets of direction buttons, each with the name help text gives the whole set.

Type Aliases§

PadId
What tells one connected pad from another: the platform’s own number for it, stable while the pad stays plugged in.
StickButtons
A stick’s direction buttons: up, down, left, right.