Wiki Page Content

Differences between revisions 3 and 4
Revision 3 as of 2010-05-17 21:45:40
Size: 1652
Editor: SheenaSmith
Comment: minor change
Revision 4 as of 2010-10-13 20:52:59
Size: 1655
Editor: SheenaSmith
Comment: update content - pointers, structs
Deletions are marked like this. Additions are marked like this.
Line 21: Line 21:
||'''secs'''||seconds of battery life left; pass a NULL if irrelevant/unimportant||
||'''pct'''||percentage of battery life left, between 0 and 100; pass a NULL if irrelevant/unimportant||
||'''secs'''||seconds of battery life left; NULL if irrelevant/unimportant||
||'''pct'''||percent of battery life left (0 - 100); NULL if irrelevant/unimportant||
Line 25: Line 25:
Returns the state of the battery (if any). Return values may be any of the following (see [[SDL_PowerState]] for more info): Returns the state of the battery, if any. Return values may be any of the following:
Line 29: Line 29:
See [[SDL_PowerState]] for more info.
Line 30: Line 32:
,,Both parameters will,, return^s^ -1 if a value can't be determined, or if not running on a battery. ,,Both parameters will,, return^s^ ,,-1 ,,^a negative error code^ if a value can't be determined, or if not running on a battery.

DRAFT

SDL_GetPowerInfo

Use this function to get the current power supply details.

Syntax

SDL_PowerState SDL_GetPowerInfo(int* secs,
                                int* pct)

Function 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

alternative text:

secs

seconds of battery life left; NULL if irrelevant/unimportant

pct

percent of battery life left (0 - 100); NULL if irrelevant/unimportant

Return Value

Returns the state of the battery, if any. Return values may be any of the following:

SDL_POWERSTATE_UNKNOWN

cannot determine power status

SDL_POWERSTATE_ON_BATTERY

not plugged in, running on the battery

SDL_POWERSTATE_NO_BATTERY

plugged in, no battery available

SDL_POWERSTATE_CHARGING

plugged in, charging battery

SDL_POWERSTATE_CHARGED

plugged in, battery charged

See SDL_PowerState for more info.

green

Both parameters will returns -1 a negative error code if a value can't be determined, or if not running on a battery.

Code Examples

You can add your code example here

Remarks

You can add useful comments here


CategoryAPI, CategoryPower

None: SDL_GetPowerInfo (last edited 2015-12-19 22:23:49 by PhilippWiesemann)

(Page Info.)
Feedback
Please include your contact information if you'd like to receive a reply.
Submit