Added SDL_GetGamepadPowerLevel() to get the power level directly from a gamepad

This commit is contained in:
Sam Lantinga
2023-07-11 07:09:24 -07:00
parent 9885f4d245
commit 2e3404db01
6 changed files with 26 additions and 1 deletions

View File

@@ -623,6 +623,18 @@ extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadFirmwareVersion(SDL_Gamepad *gamepa
*/
extern DECLSPEC const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamepad);
/**
* Get the battery level of a gamepad, if available.
*
* \param gamepad a gamepad identifier previously returned by
* SDL_OpenGamepad()
* \returns the current battery level as SDL_JoystickPowerLevel on success or
* `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown
*
* \since This function is available since SDL 3.0.0.
*/
extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_GetGamepadPowerLevel(SDL_Gamepad *gamepad);
/**
* Check if a gamepad has been opened and is currently connected.
*