Go to the source code of this file.
◆ SDL_GetPowerInfo_Impl
◆ SDL_GetPowerInfo()
Get the current power supply details.
- Parameters
-
secs | 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. |
pct | 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
- The state of the battery (if any).
Definition at line 85 of file SDL_power.c.
86{
87#ifndef SDL_POWER_DISABLED
91#endif
92
93 int _seconds, _percent;
94
95 if (seconds ==
NULL) {
96 seconds = &_seconds;
97 }
98 if (percent ==
NULL) {
99 percent = &_percent;
100 }
101
102#ifndef SDL_POWER_DISABLED
103 for (
i = 0;
i < total;
i++) {
106 }
107 }
108#endif
109
110
111 *seconds = -1;
112 *percent = -1;
114}
static SDL_GetPowerInfo_Impl implementations[]
SDL_PowerState
The basic state for the system's power supply.
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
References i, implementations, NULL, retval, and SDL_POWERSTATE_UNKNOWN.
◆ implementations