.\" This manpage content is licensed under Creative Commons .\" Attribution 4.0 International (CC BY 4.0) .\" https://creativecommons.org/licenses/by/4.0/ .\" This manpage was generated from SDL's wiki page for SDL_GetPowerInfo: .\" https://wiki.libsdl.org/SDL_GetPowerInfo .\" Generated with SDL/build-scripts/wikiheaders.pl .\" revision SDL-3.1.0 .\" Please report issues in this manpage's content at: .\" https://github.com/libsdl-org/sdlwiki/issues/new .\" Please report issues in the generation of this manpage from the wiki at: .\" https://github.com/libsdl-org/SDL/issues/new?title=Misgenerated%20manpage%20for%20SDL_GetPowerInfo .\" SDL can be found at https://libsdl.org/ .de URL \$2 \(laURL: \$1 \(ra\$3 .. .if \n[.g] .mso www.tmac .TH SDL_GetPowerInfo 3 "SDL 3.1.0" "SDL" "SDL3 FUNCTIONS" .SH NAME SDL_GetPowerInfo \- Get the current power supply details\[char46] .SH SYNOPSIS .nf .B #include \(dqSDL3/SDL.h\(dq .PP .BI "SDL_PowerState SDL_GetPowerInfo(int *seconds, int *percent); .fi .SH DESCRIPTION You should never take a battery status as absolute truth\[char46] Batteries (especially failing batteries) are delicate hardware, and the values reported here are best estimates based on what that hardware reports\[char46] 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\[char46] Battery status can change at any time; if you are concerned with power state, you should call this function frequently, and perhaps ignore changes until they seem to be stable for a few seconds\[char46] It's possible a platform can only report battery percentage or time left but not both\[char46] .SH FUNCTION PARAMETERS .TP .I 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 .TP .I 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 .SH RETURN VALUE Returns an .BR SDL_PowerState enum representing the current battery state\[char46] .SH AVAILABILITY This function is available since SDL 3\[char46]0\[char46]0\[char46]