-
Notifications
You must be signed in to change notification settings - Fork 558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add gamepad rumble feature #954
base: master
Are you sure you want to change the base?
Conversation
Functionally this seems fine, though we could maybe make use of HD rumble to do more of a "tap" rather than a traditional rumble spin for some of the more subtle effects. This isn't easily exposed in SDL right now but we support enough devices now that it's probably worth considering for SDL3... Other than that, will leave the rest to Terry for design feedback. |
Filed libsdl-org/SDL#7509 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick review.
23e5c55
to
6bad535
Compare
This commit adds a "rumble" option to the gamepad menu. Enabling it will add controller vibration to various parts of the game. Currently these events trigger a vibration, at varying degrees of intensity: - Deaths - Screen shakes - Touching checkpoints or teleporters - Touching gravity lines or gravity tokens - Collecting a trinket Further testing is likely needed. So far I have tested the feature using an 8bitdo SN30 Pro+ controller, in both Xinput and Switch modes. The rumble has different quality in either mode, and mileage may vary between other controllers, which I haven't fully tested.
A few print lines were left in by accident, causing the Game Pad and Rumble menu option titles to render over each other if the latter was high- lighted. This has been corrected.
The controllerRumble function has been cleaned up and now iterates over the map of connected controllers instead of opening handles each time rumble is used. The screenshake rumble functions have been moved into the title and game logic loops.
Changes:
This PR adds a rumble/vibration feature for players who use gamepads. It's implemented as a toggleable option (currently off by default) in the game pad options submenu.
Currently these events in the game will cause haptic feedback to occur (sorted here roughly from high to low intensity):
What still needs to be done:
Legal Stuff:
By submitting this pull request, I confirm that...
CONTRIBUTORS
file and the "GitHub Friends"section of the credits for all of said releases, but will NOT be compensated
for these changes