Repository navigation
M5.3 C3: Gamepad support - #39
Merged
Merged
Conversation
Player 1's controller (the first pad to press something) is polled every frame: standard-mapping buttons and stick directions, raw names for other pads. The left stick moves with its tilt (radial dead zone) and runs past a threshold; keys and the d-pad override it. Schema v5 adds input.analog and feel.rumble (migration 4 -> 5). Rumble on hits the player takes or lands; pause when the pad in use disconnects; inputs held through a freeze wait to be released. Prompts follow the last used device, with Xbox, PlayStation, Nintendo or generic button names. Menus can be driven with the d-pad or stick, A and B (MenuPad). The CONTROLS panel's controller tab shows whether a pad is seen, captures a pressed button, and has a dead zone slider and a vibration toggle; the Forge's controller tab captures too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AxU91KfohopVBJiiV9gwj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steve · project thread
Third PR of the extended controls plan (docs/plans/extended-controls.md, C3). With this, you can play a level and use the menus with only a controller.
What changed
src/sim/gamepad.ts) handles the rest:b7/axis2+plus a best guess by position, so the defaults still work;input.analog.runThreshold, it runs. The double-tap still works too.input.analog(deadZone,runThreshold) andfeel.rumble. Migration 4 → 5 fills in the defaults.feel.rumbleand can be turned off by the player.suppressHeld), so pressing A on RESUME doesn't also jump.inputDeviceandpadLabelsdrive this.MenuPad):nextFocus), with auto-repeat. A clicks, B resumes from pause or goes back.Testing
npm testpasses: 391 tests.suppressHeld, spatial menu nav and auto-repeat, and the v4 → v5 migration.input.analog,feel.rumble).npm run lintandnpm run buildare clean.navigator.getGamepads(a DualSense id with a fake vibration actuator):Generated by Claude Code