Why #define SDL_POWER_UIKIT 1

so in SDL_config_iphone.h there is this define

#define SDL_POWER_UIKIT 1

which means to enable battery checking every frame.
Is this something we want by default? in a very comment at SDL_power.c we read

// UIKit_GL_SwapWindow() (etc) will check this and disable the battery
//  monitoring if the app hasn't queried it in the last X seconds.
//  Apparently monitoring the battery burns battery life.  :)
//  Apple's docs say not to monitor the battery unless you need it.

in my opinion we should follow apple guidelines and set SDL_POWER_UIKIT to 0
any idea against this or some usecase that absolutely need this?

Vittorio

It’s not actually monitoring the battery every frame. It’s a timeout to
disable monitoring after 3 seconds to save power.On Tue, Jan 11, 2011 at 2:01 PM, Vittorio G. <vitto.giova at yahoo.it> wrote:

so in SDL_config_iphone.h there is this define

#define SDL_POWER_UIKIT 1

which means to enable battery checking every frame.
Is this something we want by default? in a very comment at SDL_power.c we
read

// UIKit_GL_SwapWindow() (etc) will check this and disable the battery
// monitoring if the app hasn’t queried it in the last X seconds.
// Apparently monitoring the battery burns battery life. :slight_smile:
// Apple’s docs say not to monitor the battery unless you need it.

in my opinion we should follow apple guidelines and set SDL_POWER_UIKIT to
0
any idea against this or some usecase that absolutely need this?

Vittorio


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

#define SDL_POWER_UIKIT 1

which means to enable battery checking every frame.

No it doesn’t. Setting SDL_POWER_UIKIT just lets the battery monitoring
code be included in SDL, but doesn’t turn it on until the app requests
this information by calling SDL_GetPowerInfo().

in my opinion we should follow apple guidelines and set SDL_POWER_UIKIT to 0
any idea against this or some usecase that absolutely need this?

SDL never turns on battery monitoring on iOS until the app asks for
power status. Once the user asks for the battery status, SDL will turn
the monitor back off after the app hasn’t asked for battery status for
more than 3 seconds.

–ryan.