From 2d63f3620174a976be994e214d500789b4d23d2d Mon Sep 17 00:00:00 2001 From: nkymut Date: Sat, 17 May 2025 16:03:57 +0800 Subject: [PATCH] update gamepad documentation for button mapping --- packages/gamepad/docs/gamepad.mdx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/gamepad/docs/gamepad.mdx b/packages/gamepad/docs/gamepad.mdx index 219d8ae0b..7f6dd95e5 100644 --- a/packages/gamepad/docs/gamepad.mdx +++ b/packages/gamepad/docs/gamepad.mdx @@ -106,9 +106,29 @@ $: s("free_hadouken -").slow(2) samples({free_hadouken: 'https://cdn.freesound.org/previews/67/67674_111920-lq.mp3'}) `} /> -## Multiple Gamepads +### Button Sequences + +### Button Mappings + +The gamepad module supports different button mapping configurations to accommodate various gamepad layouts: + +- **XBOX** (Default): Standard Xbox-style mapping where A=0, B=1, X=2, Y=3 +- **NES**: Nintendo-style mapping where B=0, A=1, Y=2, X=3 +- **Custom**: Define your own button mapping by passing an object with button assignments + +You can specify the mapping when initializing the gamepad: + + + +### Multiple Gamepads Strudel supports multiple gamepads. You can specify the gamepad index to connect to different devices. +Make sure to press buttons on all connected gamepads before hitting play, so the browser can properly detect them.