Skip to content
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

Add gamepad level support for misc1 and touchpad buttons #2661

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

TheSenPie
Copy link

According to the input documentation on Gamepad mappings in GLFW the misc1 and touchpad buttons are not currently supported, however they are part of the [SDL_GameControllerDB], which GLFW uses to handle logic for Xbox like controllers.

This PR adds support for missing buttons misc1 and touchpad, which are present on DualShock and DualSense controllers.

@dougbinks dougbinks added enhancement Feature suggestions and PRs input Keyboard, joystick or mouse labels Dec 18, 2024
@dougbinks dougbinks self-requested a review December 18, 2024 18:24
@dougbinks dougbinks self-assigned this Dec 18, 2024
@dougbinks
Copy link
Contributor

You've changed some of the pre-existing defines for the DPAD, which could cause issues (for example if someone serializes out their input assignment and updates GLFW). I'd recommend moving the new defines to after the end of the existing ones.

Extending the number of buttons effectively changes the API (see #2423 for a similar discussion) and so may need a new input mode with glfwSetInputMode, but I'll have to check with @elmindreda. This would mean that the defines would be something like:

#define GLFW_GAMEPAD_BUTTON_DPAD_UP         11
#define GLFW_GAMEPAD_BUTTON_DPAD_RIGHT      12
#define GLFW_GAMEPAD_BUTTON_DPAD_DOWN       13
#define GLFW_GAMEPAD_BUTTON_DPAD_LEFT       14
#define GLFW_GAMEPAD_BUTTON_LAST            GLFW_GAMEPAD_BUTTON_DPAD_LEFT
#define GLFW_GAMEPAD_BUTTON_MISC1           15
#define GLFW_GAMEPAD_BUTTON_TOUCHPAD        16
#define GLFW_GAMEPAD_BUTTON_LAST_EXT1       GLFW_GAMEPAD_BUTTON_TOUCHPAD        

@TheSenPie
Copy link
Author

TheSenPie commented Dec 18, 2024

I get your point. The reason why I added the misc1 and touchpad before dpad is exactly, because I saw that some of the code parts used the assumption GLFW_GAMEPAD_BUTTON_LAST - 4 for dpad hat impl and didn't want to mess with it. I'm not familiar with glfwSetInputMode I'll check it out.

@TheSenPie
Copy link
Author

@elmindreda any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature suggestions and PRs input Keyboard, joystick or mouse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants