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

docs: Explain events for already plugged in controllers #11272

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xordspar0
Copy link
Contributor

Description

Contrary to some online sources, SDL does generate events for joysticks already plugged in when the program starts. If you add support for additional gamepads via AddGamepadMappingsFromFile, the order is significant. We should clarify that.

Existing Issue(s)

Not an issue, but this was discussed in the forum: https://discourse.libsdl.org/t/deviced-added-events-for-devices-plugged-in-at-game-start/55039

* \since This struct is available since SDL 3.0.0.
*
* \sa SDL_AddGamepadMappingsFromFile
* \sa SDL_HINT_GAMECONTROLLERCONFIG_FILE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it's still called GAMECONTROLLERCONFIG_FILE in SDL 3. Should it be renamed to GAMEPADCONFIG_FILE?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's intentional for compatibility between SDL2 and SDL3.

I'll double check, I think you're supposed to get events for gamepads when their mappings become available. If not, we can probably change that.

Copy link
Contributor Author

@xordspar0 xordspar0 Oct 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed SDL 3 has SDL_ReloadGamepadMappings, so maybe that's a new feature in SDL 3? My testing has been with SDL 2, so I'm not sure.

This will generate gamepad events as needed if device mappings change.

@slouken slouken self-assigned this Oct 19, 2024
@slouken slouken added this to the 3.2.0 milestone Oct 19, 2024
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.

2 participants