Skip to content

Commit

Permalink
Merge pull request #853 from criezy/ios-no-sleep
Browse files Browse the repository at this point in the history
IOS: Disable idle timer while an engine is running
  • Loading branch information
sev- committed Nov 12, 2016
2 parents 915c6bf + 4a94464 commit 6da591d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions backends/platform/ios7/ios7_osys_main.h
Expand Up @@ -123,6 +123,9 @@ class OSystem_iOS7 : public EventsBaseBackend, public PaletteManager {
static OSystem_iOS7 *sharedInstance();

virtual void initBackend();

virtual void engineInit();
virtual void engineDone();

virtual bool hasFeature(Feature f);
virtual void setFeatureState(Feature f, bool enable);
Expand Down
12 changes: 12 additions & 0 deletions backends/platform/ios7/ios7_osys_video.mm
Expand Up @@ -61,6 +61,18 @@ static void displayAlert(void *ctx) {
}
}

void OSystem_iOS7::engineInit() {
EventsBaseBackend::engineInit();
// Prevent the device going to sleep during game play (and in particular cut scenes)
[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
}

void OSystem_iOS7::engineDone() {
EventsBaseBackend::engineDone();
// Allow the device going to sleep if idle while in the Launcher
[[UIApplication sharedApplication] setIdleTimerDisabled:NO];
}

void OSystem_iOS7::initVideoContext() {
_videoContext = [[iOS7AppDelegate iPhoneView] getVideoContext];
}
Expand Down

0 comments on commit 6da591d

Please sign in to comment.