-
-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
GLFW: Added support for multiple gamepads and preventing devices (such as … #4408
Conversation
Thanks for the PR! It seems like the use of
Thanks! PS: Not sure why you initially created then closed #4407 before this, but note that you can push or force-push to an existing PR branch if you need to make changes to it. |
Thanks for your quick response.
The suggestion to split this up into two commits sounds reasonable. |
171b370
to
f99fe72
Compare
Further investigations of This actually seems to work without GLFW 3.3+ on Windows, Linux and probably also on macOS. |
It is fine to use glfwGetGamepadState() if it solves more problems, we just need a compile-time alternative for pre 3.3 reverting to existing code (which may also be improved)
|
I've just implemented the above as a compile-time alternative, which should work most of the time. Edit: As I unfortunately just had to see, |
…yboards, etc.) from being reported as joysticks which would prevent gamepads from being used.
4cfdb56
to
4b9fcd9
Compare
I have just looked at the two internal functions The documentation for
Which leads me to the belief that the layout was handled the same way in the previous versions.
Since there is usually only one hat element on a gamepad, the dpad should be mapped to the last 4 buttons, which should be more robust than the current solution. The current commit contains these changes as a compile time alternative if GLFW 3.3+ is not available. |
0c1e5bd
to
bb6a60b
Compare
8b83e0a
to
d735066
Compare
b3b85d8
to
0755767
Compare
c817acb
to
8d39063
Compare
Hello @PeterSilie24 , sorry for leaving this dangling. As I understand, the rest of your PR was a workaround for situation where GLFW was older than 3.3. Given the fact that dependency update are trivial on systems other than Windows I think it is not worth adding that more-complex heuristic from the PR. Therefore closing this. Let me know if you believe there's an issue with my logic/decision. Thanks a lot for the help! |
I have encountered several problems using gamepads with imgui:
This is probably a result of a bug in GLFW.
If we want to retrieve the gamepad state on Linux with the code below, we will only be able to navigate downwards with dpad right and we can only get up by pressing the right stick.
Apparently
buttons
is indexed differently on (Manjaro) Linux and Windows.glfwGetGamepadState
instead, which behaves consistently and is especially made for gamepads.All of that should be resolved with this commit.