Skip to content
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 APIs to query joystick/gamecontroller rumble support #4943

Merged
merged 3 commits into from
Nov 11, 2021

Conversation

cgutman
Copy link
Collaborator

@cgutman cgutman commented Nov 11, 2021

Description

This PR adds SDL_JoystickHasRumble(), SDL_JoystickHasRumbleTriggers(), SDL_GameControllerHasRumble(), and SDL_GameControllerHasRumbleTriggers() to allow applications to query what types of rumble are supported by a given joystick/gamecontroller.

To make this (and other similar changes in the future) easier, I converted HasLED() to a more generic GetCapabilities() function which returns LED, rumble, and trigger rumble capabilities.

Along with being useful for applications, these APIs also allow us to implement virtual SDL_Haptic support on top of SDL_Joystick for backwards compatibility with code using the legacy haptics API.

When API limitations force us to guess, we favor a false positive (reporting
support when it doesn't exist) compared to a false negative.
@slouken slouken merged commit fe09a49 into libsdl-org:main Nov 11, 2021
@cgutman cgutman deleted the rumble_caps branch November 24, 2021 20:53
meyerj added a commit to meyerj/joystick_drivers that referenced this pull request Oct 19, 2023
SDL_GameControllerHasRumble() was introduced in SDL 2.0.18 only (libsdl-org/SDL#4943).

Signed-off-by: Johannes Meyer <[email protected]>
clalancette pushed a commit to ros-drivers/joystick_drivers that referenced this pull request Oct 23, 2023
SDL_GameControllerHasRumble() was introduced in SDL 2.0.18 only (libsdl-org/SDL#4943).

Signed-off-by: Johannes Meyer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants