1010 * # CategoryPower
1111 *
1212 * SDL power management routines.
13+ *
14+ * There is a single function in this category: SDL_GetPowerInfo ().
15+ *
16+ * This function is useful for games on the go. This allows an app to know if
17+ * it' s running on a draining battery, which can be useful if the app wants to
18+ * reduce processing, or perhaps framerate, to extend the duration of the
19+ * battery' s charge. Perhaps the app just wants to show a battery meter when
20+ * fullscreen, or alert the user when the power is getting extremely low, so
21+ * they can save their game.
1322 }
1423
1524{*
1625 * The basic state for the system' s power supply.
1726 *
1827 * These are results returned by SDL_GetPowerInfo().
1928 *
20- * \s ince This enum is available since SDL 3.1.3
29+ * \s ince This enum is available since SDL 3.2.0
2130 }
2231type
2332 PPSDL_PowerState = ^PSDL_PowerState;
2433 PSDL_PowerState = ^TSDL_PowerState;
2534 TSDL_PowerState = type Integer;
2635const
27- SDL_POWERSTATE_ERROR = -1; {*< error determining power status }
36+ SDL_POWERSTATE_ERROR = TSDL_PowerState(-1); {*< error determining power status }
2837 SDL_POWERSTATE_UNKNOWN = TSDL_PowerState(0); {*< cannot determine power status }
2938 SDL_POWERSTATE_ON_BATTERY = TSDL_PowerState(1); {*< Not plugged in, running on the battery }
3039 SDL_POWERSTATE_NO_BATTERY = TSDL_PowerState(2); {*< Plugged in, no battery available }
@@ -47,17 +56,23 @@ const
4756 * It' s possible a platform can only report battery percentage or time left
4857 * but not both.
4958 *
50- * \p aram seconds a Pointer filled in with the seconds of battery life left,
51- * or nil to ignore. This will be filled in with -1 if we
59+ * On some platforms, retrieving power supply details might be expensive. If
60+ * you want to display continuous status you could call this function every
61+ * minute or so.
62+ *
63+ * \p aram seconds a pointer filled in with the seconds of battery life left,
64+ * or NULL to ignore. This will be filled in with -1 if we
5265 * can' t determine a value or there is no battery.
53- * \param percent a Pointer filled in with the percentage of battery life
54- * left, between 0 and 100 , or nil to ignore. This will be
55- * filled in with -1 we can' t determine a value or there is no
56- * battery.
66+ * \param percent a pointer filled in with the percentage of battery life
67+ * left, between 0 and 100 , or NULL to ignore. This will be
68+ * filled in with -1 when we can' t determine a value or there
69+ * is no battery.
5770 * \r eturns the current battery state or `SDL_POWERSTATE_ERROR` on failure;
5871 * call SDL_GetError() for more information.
5972 *
60- * \s ince This function is available since SDL 3.1.3.
73+ * \t hreadsafety This function is not thread safe.
74+ *
75+ * \s ince This function is available since SDL 3.2.0.
6176 }
6277function SDL_GetPowerInfo(seconds: pcint; percent: pcint): TSDL_PowerState; cdecl;
6378 external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name ' _SDL_GetPowerInfo' {$ENDIF} {$ENDIF};
0 commit comments