-
-
Notifications
You must be signed in to change notification settings - Fork 23.9k
Add support for SDL3 joystick input driver for the web platform (Emscripten) #114318
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
Conversation
This commit also adds joystick vibration feature to the web platform in browsers that support this feature.
| - 'weakMagnitude': $1 / 0xFFFF, | ||
| - 'strongMagnitude': $2 / 0xFFFF, | ||
| + 'weakMagnitude': $2 / 0xFFFF, | ||
| + 'strongMagnitude': $1 / 0xFFFF, |
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.
See also libsdl-org/SDL#14703
| - "default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", | ||
| + "default,*,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", |
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.
See also libsdl-org/SDL#14704
| static SDL_joylist_item *SDL_joylist_tail = NULL; | ||
| static int numjoysticks = 0; | ||
|
|
||
| +EM_JS(int, SDL_GetEmscriptenJoystickVendor, (int device_index), { |
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.
See also libsdl-org/SDL#14003
|
Although now that I think about it, I'm not sure if this PR is necessary since it doesn't fix a lot of issues, and the vibration issue I linked can easily be fixed without integrating SDL. |
|
I decided it's not really worth it to integrate SDL's Android and web joystick drivers since that wouldn't fix a lot of issues and it might introduce regressions, and the only benefit might be that we'll be able to port small fixes from/to SDL more easily, unless I'm misunderstanding something, so I'll close this PR for now. |
Follow-up to #106218
Fixes #96985
I decided to split #109645 into several smaller PRs, this PR is one of them.
This PR adds support for SDL3 joystick input driver for the web platform, as well as adding support for
Input.get_joy_info()on that platform.TODO: