-
Notifications
You must be signed in to change notification settings - Fork 2.4k
docs: Explain events for already plugged in controllers #11272
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -549,7 +549,12 @@ typedef struct SDL_JoyButtonEvent | |
/** | ||
* Joystick device event structure (event.jdevice.*) | ||
* | ||
* SDL will populate the event queue with JOYSTICK_ADDED events for devices that | ||
* are already plugged in during SDL_Init. | ||
* | ||
* \since This struct is available since SDL 3.0.0. | ||
* | ||
* \sa SDL_GamepadDeviceEvent | ||
*/ | ||
typedef struct SDL_JoyDeviceEvent | ||
{ | ||
|
@@ -615,7 +620,27 @@ typedef struct SDL_GamepadButtonEvent | |
/** | ||
* Gamepad device event structure (event.gdevice.*) | ||
* | ||
* Joysticks that are supported Gamepads receive both an SDL_JoyDeviceEvent and | ||
* an SDL_GamepadDeviceEvent. | ||
* | ||
* SDL will populate the event queue with GAMEPAD_ADDED events for joysticks | ||
* that are already plugged in duing SDL_Init and are recognized as Gamepads. | ||
* | ||
* GAMEPAD_ADDED events for controllers plugged in at the start of the program | ||
* will not occur automatically if their mappings are added after calling | ||
* SDL_Init. | ||
* | ||
* If you rely on GAMEPAD_ADDED events to tell you about controllers that are | ||
* already plugged in at the start of the program, and you use | ||
* SDL_AddGamepadMappingsFromFile to add support for additional controllers, | ||
* you can ensure that you get GAMEPAD_ADDED events for all controllers if you | ||
* load the mappings before calling SDL_Init. | ||
* | ||
* \since This struct is available since SDL 3.0.0. | ||
* | ||
* \sa SDL_AddGamepadMappingsFromFile | ||
* \sa SDL_HINT_GAMECONTROLLERCONFIG_FILE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
|
||
* \sa SDL_JoyDeviceEvent | ||
*/ | ||
typedef struct SDL_GamepadDeviceEvent | ||
{ | ||
|
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.
Yeah, I confirmed that this is not true in SDL3.
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.
Awesome, that's great news.