* SDL_IOS_IDLE_TIMER_DISABLED hint
This commit is contained in:
parent
a36a856bf9
commit
2f0bec3220
7 changed files with 62 additions and 1 deletions
|
@ -20,6 +20,9 @@
|
|||
*/
|
||||
|
||||
#import "../SDL_sysvideo.h"
|
||||
#import "SDL_assert.h"
|
||||
#import "SDL_hints.h"
|
||||
#import "../../SDL_hints_c.h"
|
||||
|
||||
#import "SDL_uikitappdelegate.h"
|
||||
#import "SDL_uikitopenglview.h"
|
||||
|
@ -55,6 +58,13 @@ int main(int argc, char **argv) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void SDL_IdleTimerDisabledChanged(const char *name, const char *oldValue, const char *newValue) {
|
||||
SDL_assert(SDL_strcmp(name, SDL_HINT_IDLE_TIMER_DISABLED) == 0);
|
||||
|
||||
BOOL disable = (*newValue != '0');
|
||||
[UIApplication sharedApplication].idleTimerDisabled = disable;
|
||||
}
|
||||
|
||||
@implementation SDLUIKitDelegate
|
||||
|
||||
/* convenience method */
|
||||
|
@ -75,6 +85,10 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
|
||||
- (void)postFinishLaunch {
|
||||
|
||||
/* register a callback for the idletimer hint */
|
||||
SDL_SetHint(SDL_HINT_IDLE_TIMER_DISABLED, "0");
|
||||
SDL_RegisterHintChangedCb(SDL_HINT_IDLE_TIMER_DISABLED, &SDL_IdleTimerDisabledChanged);
|
||||
|
||||
/* run the user's application, passing argc and argv */
|
||||
int exit_status = SDL_main(forward_argc, forward_argv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue