Skip to content

Commit 146c989

Browse files
Update SDL_power.inc to 3.4.2
1 parent 80e7e52 commit 146c989

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

units/SDL3.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ interface
9696
{$I SDL_video.inc} // 3.4.2
9797
{$I SDL_timer.inc} // 3.2.20
9898
{$I SDL_error.inc} // 3.4.2
99-
{$I SDL_power.inc} // 3.1.6-prev
99+
{$I SDL_power.inc} // 3.4.2
100100
{$I SDL_audio.inc} // 3.1.6-prev
101101
{$I SDL_sensor.inc} // 3.1.6-prev
102102
{$I SDL_scancode.inc} // 3.1.6-prev

units/SDL_power.inc

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,30 @@
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-
* \since This enum is available since SDL 3.1.3
29+
* \since This enum is available since SDL 3.2.0
2130
}
2231
type
2332
PPSDL_PowerState = ^PSDL_PowerState;
2433
PSDL_PowerState = ^TSDL_PowerState;
2534
TSDL_PowerState = type Integer;
2635
const
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-
* \param 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+
* \param 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
* \returns the current battery state or `SDL_POWERSTATE_ERROR` on failure;
5871
* call SDL_GetError() for more information.
5972
*
60-
* \since This function is available since SDL 3.1.3.
73+
* \threadsafety This function is not thread safe.
74+
*
75+
* \since This function is available since SDL 3.2.0.
6176
}
6277
function 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

Comments
 (0)