Skip to content
Alvaro Montoro edited this page Aug 30, 2019 · 1 revision

The standard gamepad layout is described in the Gamepad API specification:

Standard gamepad layout drawn by Alvaro Montoro

Not all gamepads will follow this layout. There are gamepads/joysticks with 4 buttons, or 10 buttons, or 17 buttons... but the gamepads that follow this standard layout will also follow a pattern:

  • Button 4 will be the left back button (L1).
  • Button 5 will be the right back button (R1).
  • Button 8 will be the Select/Back button.
  • Button 9 will be the Start/Forward button.

This will allow to simplify the process for standard-layout gamepads. You can check if your gamepad follows this layout by reading the mapping property:

if (gamepad.mapping === "standard") {
  // the controls have been mapped to the standard layout
} else {
  // the controls may not follow the standard layout
}

If the connected gamepad does not follow the standard layout (or even if it does), developers may want to prompt a remapping option, to verify which gamepad button is mapped to which API button.

Clone this wiki locally