Improved reliability of gamepad message ordering
The gamepad vs joystick events always happen in this order: SDL_EVENT_JOYSTICK_ADDED SDL_EVENT_GAMEPAD_ADDED SDL_EVENT_GAMEPAD_REMAPPED SDL_EVENT_GAMEPAD_REMOVED SDL_EVENT_JOYSTICK_REMOVED Whenever a mapping is changed, any controller affected by that mapping will generate a gamepad event. You will only get one SDL_EVENT_GAMEPAD_REMAPPED event per controller per batch of mapping changes, where SDL_AddGamepadMappingsFromFile() and SDL_AddGamepadMapping() are each a batch of changes.
This commit is contained in:
parent
ccefce8321
commit
dfc6e8825e
5 changed files with 356 additions and 178 deletions
|
@ -32,6 +32,8 @@ extern void SDL_QuitGamepadMappings(void);
|
|||
extern int SDL_InitGamepads(void);
|
||||
extern void SDL_QuitGamepads(void);
|
||||
|
||||
extern void SDL_PrivateGamepadAdded(SDL_JoystickID instance_id);
|
||||
extern void SDL_PrivateGamepadRemoved(SDL_JoystickID instance_id);
|
||||
|
||||
/* Function to return whether a joystick name and GUID is a gamepad */
|
||||
extern SDL_bool SDL_IsGamepadNameAndGUID(const char *name, SDL_JoystickGUID guid);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue