-
-
Notifications
You must be signed in to change notification settings - Fork 22.7k
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
base: master
Are you sure you want to change the base?
Conversation
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 😄 |
9940d41
to
9e6d7d8
Compare
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! |
9e6d7d8
to
b39eef9
Compare
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.
b39eef9
to
e70bbb5
Compare
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). |
Will the gamepad type for GameCube controllers be included? It seems to be the only one not added from |
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! 😄 |
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! |
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:
Input.get_joy_model()
(because JoyType enum already exists) andInput.get_joy_scheme()
(see SDL_GetGamepadType)Input.get_joy_info()
(see Get joypad's vendor ID, product ID and name on Windows for XInput devices. #98861 )InputEventJoypadAccelerometer
,InputEventJoypadGyroscope
)Input.start_joy_motion_calibration()
,Input.step_joy_motion_calibration()
,Input.stop_joy_motion_calibration()
)SDL_JoystickType
): https://learn.microsoft.com/en-us/windows/win32/xinput/xinput-and-controller-subtypesInput.get_joy_info()
fieldsTODO when Godot starts supporting SDL for other platforms:
TODO for separate PRs:
Input.get_pov_hat_vector()
(see AddInputEventJoypadHat
godot-proposals#9850 )InputEventJoypadHat
godot-proposals#9850 ) and ball eventsFeatures that need to be discussed whether they should be implemented or not:
Input.send_joy_packet()
SDL_SendJoystickEffectHere'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)