Man page - sdl_getjoystickpowerinfo(3)
Packages contains this manual
Manual
SDL_GetJoystickPowerInfo
NAMEHEADER FILE
SYNOPSIS
DESCRIPTION
FUNCTION PARAMETERS
RETURN VALUE
AVAILABILITY
NAME
SDL_GetJoystickPowerInfo - Get the battery state of a joystick.
HEADER FILE
Defined in SDL3/SDL_joystick.h
SYNOPSIS
#include "SDL3/SDL.h"
SDL_PowerState SDL_GetJoystickPowerInfo(SDL_Joystick *joystick, int *percent);
DESCRIPTION
You should never take a battery status as absolute truth. Batteries (especially failing batteries) are delicate hardware, and the values reported here are best estimates based on what that hardware reports. Itβs not uncommon for older batteries to lose stored power much faster than it reports, or completely drain when reporting it has 20 percent left, etc.
FUNCTION PARAMETERS
joystick
the joystick to query.
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.
RETURN VALUE
( SDL_PowerState ) Returns the current battery state or
SDL_POWERSTATE_ERROR on failure; call
SDL_GetError () for more information.
AVAILABILITY
This function is available since SDL 3.2.0.