Skip to content

Introduce new joypad features provided by SDL3 (WIP) #107967

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Nintorch
Copy link
Contributor

@Nintorch Nintorch commented Jun 25, 2025

Partially based on #88590

Closes godotengine/godot-proposals#2829
Closes godotengine/godot-proposals#8519
Closes godotengine/godot-proposals#6930
Closes godotengine/godot-proposals#3799
Potentially closes #98008

Supersedes #88590
Supersedes #89193

Since SDL joypad driver was merged recently ( #106218 ), this PR adds support for new SDL joypad features that weren't previously possible due to older custom joypad implementations. These features include accelerometer, gyroscope, LED lights, touchpads and more.

The features that need to be done before this PR is ready for review/merge, i.e. the roadmap:

TODO when Godot starts supporting SDL for other platforms:

  • Android support
  • iOS support
  • Web support?

TODO for separate PRs:

Features that need to be discussed whether they should be implemented or not:

Here's a small project to test new joypad features (in case someone might build this WIP PR from scratch) :
JoypadTest.zip

(P.S. I opened this PR so early, because I want to let people know that this is being worked on and that I'm working on it :D)

@Calinou
Copy link
Member

Calinou commented Jun 25, 2025

Supersedes #88590

Note that #88590 also implements DualSense adaptive triggers, which isn't on the roadmap of this PR currently. This could be done in a separate PR in any case, but I thought I'd mention it as SDL supports adaptive triggers.

@Nintorch
Copy link
Contributor Author

Supersedes #88590

Note that #88590 also implements DualSense adaptive triggers, which isn't on the roadmap of this PR currently. This could be done in a separate PR in any case, but I thought I'd mention it as SDL supports adaptive triggers.

Good catch, thank you, I'll add that to the roadmap!

@Meorge
Copy link
Contributor

Meorge commented Jun 25, 2025

I'm especially excited to see Joy-Con support listed here. I think those are really fun little controllers, so much so that I started making my own C++ library for interfacing with them and a Godot GDExtension based off of that - however, obviously being a GDExtension, it doesn't mesh very well with Godot's built-in APIs. Having the support be more built-in to the engine would be awesome!

I'm not sure how much overlap there is between SDL's Joy-Con support and what my library does, but if a lot of the Joy-Con-specific features don't have SDL APIs, I may be able to help on that front 😄

@Nintorch Nintorch force-pushed the joypad-new-sdl-features branch 2 times, most recently from 9940d41 to 9e6d7d8 Compare June 26, 2025 13:25
@Nintorch
Copy link
Contributor Author

I made a list of features that need discussion before implementing, so if you think any of the listed features are important to have built into the engine, you can let me know!

@Nintorch Nintorch changed the title Add support for new SDL joypad features (gyroscope, accelerometer, LED, etc.) (WIP) Introduce new joypad features provided by SDL3 (WIP) Jun 26, 2025
@Nintorch Nintorch force-pushed the joypad-new-sdl-features branch from 9e6d7d8 to b39eef9 Compare June 27, 2025 07:03
This commit adds support for new SDL joypad features that weren't previously possible due to older custom joypad implementations.
These features include accelerometer, gyroscope, LED lights, touchpads and more.
@Nintorch Nintorch force-pushed the joypad-new-sdl-features branch from b39eef9 to e70bbb5 Compare June 27, 2025 18:47
@mubinulhaque
Copy link

mubinulhaque commented Jun 28, 2025

Feature request for a separate PR: querying for separate keyboards and mice (SDL_GetKeyboards and SDL_GetMice respectively)

@Calinou
Copy link
Member

Calinou commented Jun 28, 2025

Feature request for a separate PR: querying for separate keyboards and mice (SDL_GetKeyboards and SDL_GetMice respectively)

Multi-keyboard/mouse support seems subpar in SDL 3 from what I've heard, so it may not be worth the effort. This is based on what I've seen in the Perfect Dark PC port Discord (people have tried implementing it there, but quickly regretted it).

@LunaCapra
Copy link
Contributor

Will the gamepad type for GameCube controllers be included? It seems to be the only one not added from SDL_GamepadType.

@Meorge
Copy link
Contributor

Meorge commented Jun 28, 2025

I'm still very excited for Joy-Con support and would love to contribute where I can, but thinking about it more, I think specialized support for its features would fit better as a separate PR (if not some kind of plugin/addon). 😅

Maintainers should have more of a say in this of course, but I could see it being helpful to split this up into multiple smaller PRs so that each individual one is easier to test and verify.

That all being said, for this PR (whether it ends up being split later or not) I can certainly test its functionality on macOS. Let me know if/when you'd like me to give that a shot! 😄

@Nintorch
Copy link
Contributor Author

Will the gamepad type for GameCube controllers be included? It seems to be the only one not added from SDL_GamepadType.

Godot is currently using the latest stable release of SDL (3.2.16), which doesn't support GameCube controllers :( https://github.com/libsdl-org/SDL/blob/c9a6709bd21750f1ad9597be21abace78c6378c9/include/SDL3/SDL_gamepad.h

@LunaCapra
Copy link
Contributor

Will the gamepad type for GameCube controllers be included? It seems to be the only one not added from SDL_GamepadType.

Godot is currently using the latest stable release of SDL (3.2.16), which doesn't support GameCube controllers :( https://github.com/libsdl-org/SDL/blob/c9a6709bd21750f1ad9597be21abace78c6378c9/include/SDL3/SDL_gamepad.h

That's a shame. Maybe in the future then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment