dependencies/SDL/include/SDL_gamecontroller.h in gosu-1.4.5.pre1 vs dependencies/SDL/include/SDL_gamecontroller.h in gosu-1.4.5

- old
+ new

@@ -67,11 +67,15 @@ SDL_CONTROLLER_TYPE_PS4, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO, SDL_CONTROLLER_TYPE_VIRTUAL, SDL_CONTROLLER_TYPE_PS5, SDL_CONTROLLER_TYPE_AMAZON_LUNA, - SDL_CONTROLLER_TYPE_GOOGLE_STADIA + SDL_CONTROLLER_TYPE_GOOGLE_STADIA, + SDL_CONTROLLER_TYPE_NVIDIA_SHIELD, + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR } SDL_GameControllerType; typedef enum { SDL_CONTROLLER_BINDTYPE_NONE = 0, @@ -288,10 +292,29 @@ * \sa SDL_IsGameController */ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); /** + * Get the implementation dependent path for the game controller. + * + * This function can be called before any controllers are opened. + * + * `joystick_index` is the same as the `device_index` passed to + * SDL_JoystickOpen(). + * + * \param joystick_index the device_index of a device, from zero to + * SDL_NumJoysticks()-1 + * \returns the implementation-dependent path for the game controller, or NULL + * if there is no path or the index is invalid. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GameControllerPath + */ +extern DECLSPEC const char *SDLCALL SDL_GameControllerPathForIndex(int joystick_index); + +/** * Get the type of a game controller. * * This can be called before any controllers are opened. * * \param joystick_index the device_index of a device, from zero to @@ -385,10 +408,27 @@ * \sa SDL_GameControllerOpen */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); /** + * Get the implementation-dependent path for an opened game controller. + * + * This is the same path as returned by SDL_GameControllerNameForIndex(), but + * it takes a controller identifier instead of the (unstable) device index. + * + * \param gamecontroller a game controller identifier previously returned by + * SDL_GameControllerOpen() + * \returns the implementation dependent path for the game controller, or NULL + * if there is no path or the identifier passed is invalid. + * + * \since This function is available since SDL 2.24.0. + * + * \sa SDL_GameControllerPathForIndex + */ +extern DECLSPEC const char *SDLCALL SDL_GameControllerPath(SDL_GameController *gamecontroller); + +/** * Get the type of this currently opened controller * * This is the same name as returned by SDL_GameControllerTypeForIndex(), but * it takes a controller identifier instead of the (unstable) device index. * @@ -413,11 +453,12 @@ /** * Set the player index of an opened game controller. * * \param gamecontroller the game controller object to adjust. - * \param player_index Player index to assign to this controller. + * \param player_index Player index to assign to this controller, or -1 to + * clear the player index and turn off player LEDs. * * \since This function is available since SDL 2.0.12. */ extern DECLSPEC void SDLCALL SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int player_index); @@ -456,10 +497,22 @@ * \since This function is available since SDL 2.0.6. */ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller); /** + * Get the firmware version of an opened controller, if available. + * + * If the firmware version isn't available this function returns 0. + * + * \param gamecontroller the game controller object to query. + * \return the controller firmware version, or zero if unavailable. + * + * \since This function is available since SDL 2.24.0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller); + +/** * Get the serial number of an opened controller, if available. * * Returns the serial number of the controller, or NULL if it is not * available. * @@ -699,11 +752,11 @@ * Convert from an SDL_GameControllerButton enum to a string. * * The caller should not SDL_free() the returned string. * * \param button an enum value for a given SDL_GameControllerButton - * \returns a string for the given button, or NULL if an invalid axis is + * \returns a string for the given button, or NULL if an invalid button is * specified. The string returned is of the format used by * SDL_GameController mapping strings. * * \since This function is available since SDL 2.0.0. * @@ -841,10 +894,29 @@ * \since This function is available since SDL 2.0.14. */ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *gamecontroller, SDL_SensorType type, float *data, int num_values); /** + * Get the current state of a game controller sensor with the timestamp of the + * last update. + * + * The number of values and interpretation of the data is sensor dependent. + * See SDL_sensor.h for the details for each type of sensor. + * + * \param gamecontroller The controller to query + * \param type The type of sensor to query + * \param timestamp A pointer filled with the timestamp in microseconds of the + * current sensor reading if available, or 0 if not + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * \return 0 or -1 if an error occurred. + * + * \since This function is available since SDL 2.26.0. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_GameController *gamecontroller, SDL_SensorType type, Uint64 *timestamp, float *data, int num_values); + +/** * Start a rumble effect on a game controller. * * Each call to this function cancels any previous rumble effect, and calling * it with 0 intensity stops any rumbling. * @@ -867,11 +939,12 @@ * * Each call to this function cancels any previous trigger rumble effect, and * calling it with 0 intensity stops any rumbling. * * Note that this is rumbling of the _triggers_ and not the game controller as - * a whole. The first controller to offer this feature was the PlayStation 5's - * DualShock 5. + * a whole. This is currently only supported on Xbox One controllers. If you + * want the (more common) whole-controller rumble, use + * SDL_GameControllerRumble() instead. * * \param gamecontroller The controller to vibrate * \param left_rumble The intensity of the left trigger rumble motor, from 0 * to 0xFFFF * \param right_rumble The intensity of the right trigger rumble motor, from 0