| Summary: | Missing GameController Functions -- InstanceID, NumAxes, NumButtons | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Intellectual Kitty <IntellectualKitty> |
| Component: | joystick | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | amaranth72 |
| Version: | 2.0.4 | ||
| Hardware: | x86 | ||
| OS: | Other | ||
(In reply to Intellectual Kitty from comment #0) > int SDL_GameControllerNumAxes(SDL_GameController* gamecontroller); > int SDL_GameControllerNumButtons(SDL_GameController* gamecontroller); GameControllers have a fixed set of axes and buttons. You can cast SDL_CONTROLLER_AXIS_MAX and SDL_CONTROLLER_BUTTON_MAX to ints to find out how many (at compile time). (In reply to Intellectual Kitty from comment #0) > The lack of SDL_GameControllerInstanceID is particularly problematic since > the SDL_CONTROLLERDEVICEADDED event will provide a device_index in > event.cdevice.which (where event is an SDL_Event struct) rather than an > instance ID. Without SDL_GameControllerInstanceID, there is no way to > obtain the instance ID. event.cdevice.which gives back a device index (usable with SDL_IsGameController(int joystick_index) and SDL_GameControllerOpen(int joystick_index) on connect, and the joystick instance ID (usable with SDL_GameControllerFromInstanceID(SDL_JoystickID joyid), or JoystickInstanceID(SDL_GameControllerGetJoystick(controller))) on disconnect. Thank you, Alex. That clarifies all of my problems. Thanks Alex! This is actually not a fixed bug, just closed. |
The following functions (which have corresponding counterparts in the Joystick interface) are missing from the GameController interface: SDL_GameControllerID SDL_GameControllerInstanceID(SDL_GameController* gamecontroller); int SDL_GameControllerNumAxes(SDL_GameController* gamecontroller); int SDL_GameControllerNumButtons(SDL_GameController* gamecontroller); The lack of SDL_GameControllerInstanceID is particularly problematic since the SDL_CONTROLLERDEVICEADDED event will provide a device_index in event.cdevice.which (where event is an SDL_Event struct) rather than an instance ID. Without SDL_GameControllerInstanceID, there is no way to obtain the instance ID.