Input · type

GamepadButton

The W3C Standard Gamepad, by position rather than by anybody's lettering.

Explained in Moving things.

type GamepadButton = 'faceDown' | 'faceRight' | 'faceLeft' | 'faceUp' | 'l1' | 'r1' | 'l2' | 'r2' | 'select' | 'start' | 'l3' | 'r3' | 'dpadUp' | 'dpadDown' | 'dpadLeft' | 'dpadRight' | 'guide'
import type { GamepadButton } from '@driftengine/core';

In depth

The names are positional and that is a correctness decision, not a style one. Index 0 is the bottom button of the right cluster. It is labelled A on an Xbox pad, Cross on a PlayStation pad and B on a Nintendo pad, because Nintendo's physical layout swaps the two. Any lettering this file picked would therefore be a false statement about somebody's hardware. It names the position, which is true everywhere; gamepadIdentity.ts answers what that position is called on the pad actually in the player's hands.

A browser sets mapping: 'standard' only when it is confident the device matches this table. Anything else is served by raw index and says so once — see InputSource's pad view.