Hello. I am porting my code to use SDL2 and I of course want to use the Gamecontroller API. I have some questions about how to use this. I think i’ve kinda figured out some of these answers but I just wanted to get a solid yes/no. My questions:
-
I notice that Hats and Balls are both gone in the Gamecontroller interface. I notice that Hats have been merged into Buttons. What about balls? Does Gamecontroller simply not support controllers with trackballs?
-
What happens if I call SDL_GameControllerOpen on a joystick for which SDL_IsGameController is false? Does it return NULL?
-
For which gamepads is SDL_IsGameController false? I assume SDL_IsGameController is true iff the controller does not have a loaded binding?
-
Is it safe and acceptable to call SDL_JoystickOpen and SDL_GameControllerOpen on a single joystick ID at the same time?
-
What is the meaning of the Game Controller “string” for axis and button? I suppose the idea is the string is “whatever it says in the mappings file”. However, the “recommended” gamecontrollerdb.txt on the wiki seems to have consistent and specific values for all buttons. Strings like “dpdown” and “rightshoulder” show up consistently. Are these strings standardized? Are they documented somewhere? They all seem to kind of make sense just from the names (x is a face button, rightx is the right analog stick, “guide” is the ps3 logo button… “back” is select?) but it would be nice to have an explicit list (as is one simply has to guess which face buttons a,b,x,y correspond to).
5a. Would I be correct to surmise that gamecontrollerdb.txt corresponds to the XBox 360 controller buttons and nothing else? Right and left analog stick depress are not meant to be represented? Fighting sticks are not meant to be represented?
-
Who maintains this mysterious “community sourced” gamecontrollerdb.txt linked on the wiki ( https://wiki.libsdl.org/SDL_GameControllerAddMappingsFromFile?highlight=(\bCategoryGameController\b)|(CategoryEnum) )? Do they take pull requests?
-
The “strings” in gamecontrollerdb.txt all seem to be semantic-- “Y” means (again assuming these are 360 buttons) “top” diamond. However if I present a UI, I will want to at some point describe the buttons to the player using the actual symbols they see on the gamepad, like “Triangle” if it’s a PS3 controller. Am I correct this “human-readable name” information is not tracked by SDL2 at all? Has there been any community attempt to gather such information?
-
Would I be correct to assume that the “device index” used for any one device (used by e.g. SDL_JoystickOpen) could potentially change anytime a joystick is plugged in or removed?
-
Is “device index” the same thing as “instance ID”? The doc for SDL_JoyDeviceEvent ( https://wiki.libsdl.org/SDL_JoyDeviceEvent?highlight=(\bCategoryStruct\b)|(SDLStructTemplate) ) implies they are two things (“the joystick device index for the SDL_JOYDEVICEADDED event or the instance id for the SDL_JOYDEVICEREMOVED event”) but the doc for SDL_JoystickInstanceID seems to use the two terms interchangeably.
-
If I have opened a joystick, and then I open the same joystick again, will it return a new SDL_Joystick object or return the previously allocated SDL_Joystick object?
-
If I have opened a joystick, and I receive a corresponding SDL_JOYDEVICEREMOVED, am I obligated to call SDL_JoystickClose or will this be done for me?