Merge pull request #853 from criezy/ios-no-sleep

IOS: Disable idle timer while an engine is running
This commit is contained in:
Eugene Sandulenko 2016-11-12 12:20:17 +01:00 committed by GitHub
commit 6da591df88
2 changed files with 15 additions and 0 deletions

View File

@ -123,6 +123,9 @@ public:
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);

View File

@ -61,6 +61,18 @@ void OSystem_iOS7::fatalError() {
}
}
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];
}