Skip to content

joystick: Treat d-pads as hat switches at the SDL_Joystick level.#15869

Open
icculus wants to merge 4 commits into
libsdl-org:mainfrom
icculus:sdl3-joystick-hat-switches
Open

joystick: Treat d-pads as hat switches at the SDL_Joystick level.#15869
icculus wants to merge 4 commits into
libsdl-org:mainfrom
icculus:sdl3-joystick-hat-switches

Conversation

@icculus

@icculus icculus commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator
  • I confirm that I am the author of this code and release it to the SDL project under the Zlib license. This contribution does not contain code from other sources, including code generated by a Large Language Model ("AI").

This is still a draft, because there are more platforms to rework yet. This adjusts the n3ds backend, but apparently PS2, PSP, and Vita need similar efforts. (EDIT: all platforms are done.)

Also, I do not have any way to even compile this code at the moment, so it could be totally broken. @ccawley2011, if you could give this a try, I'd appreciate it. The Snake demo example should work now, if I didn't screw this up, and examples/input/01-joystick-polling should now have a working dpad showing at the bottom of the display, four less buttons listed at the top, and all of the remaining buttons still pressable.

Fixes #14830.

@icculus icculus force-pushed the sdl3-joystick-hat-switches branch 4 times, most recently from 9392d56 to 18f8f3a Compare June 22, 2026 16:29
@icculus icculus force-pushed the sdl3-joystick-hat-switches branch from 18f8f3a to afef15c Compare June 22, 2026 17:11
@icculus icculus force-pushed the sdl3-joystick-hat-switches branch from afef15c to 9c71092 Compare June 22, 2026 17:21
@icculus icculus force-pushed the sdl3-joystick-hat-switches branch from 9c71092 to a28c7f2 Compare June 22, 2026 18:26
@icculus icculus self-assigned this Jun 22, 2026
@icculus icculus added this to the 3.6.0 milestone Jun 22, 2026
@icculus icculus marked this pull request as ready for review June 22, 2026 19:21
@icculus

icculus commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator Author

Okay, this is implemented for all the backends in question now, and it all compiles (full CI is over here).

Any testing that can be done would be appreciated; I don't have a setup for any of these platforms (N3DS, PS2, PSP, Vita).

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.

demo-snake requires a joystick hat

1 participant