mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-01 09:27:39 +00:00
Separate joystick power state into battery status and percentage
This allows you to see battery percentage while the controller is charging
This commit is contained in:
parent
5e624c2083
commit
8847b35244
42 changed files with 596 additions and 1001 deletions
|
@ -41,6 +41,7 @@ extern "C" {
|
|||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_POWERSTATE_ERROR = -1, /**< error determining power status */
|
||||
SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
|
||||
SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
|
||||
SDL_POWERSTATE_NO_BATTERY, /**< Plugged in, no battery available */
|
||||
|
@ -64,13 +65,9 @@ typedef enum
|
|||
* It's possible a platform can only report battery percentage or time left
|
||||
* but not both.
|
||||
*
|
||||
* \param seconds seconds of battery life left, you can pass a NULL here if
|
||||
* you don't care, will return -1 if we can't determine a
|
||||
* value, or we're not running on a battery
|
||||
* \param percent percentage of battery life left, between 0 and 100, you can
|
||||
* pass a NULL here if you don't care, will return -1 if we
|
||||
* can't determine a value, or we're not running on a battery
|
||||
* \returns an SDL_PowerState enum representing the current battery state.
|
||||
* \param seconds a pointer filled in with the seconds of battery life left, or NULL to ignore. This will be filled in with -1 if we can't determine a value or there is no battery.
|
||||
* \param percent a pointer filled in with the percentage of battery life left, between 0 and 100, or NULL to ignore. This will be filled in with -1 we can't determine a value or there is no battery.
|
||||
* \returns the current battery state or `SDL_POWERSTATE_ERROR` on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.0.0.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue