fix iOS deltatime (#18084)

* fix ios delta time when resumes from background

* remove debug codes
This commit is contained in:
minggo 2017-07-18 14:01:53 +08:00 committed by GitHub
parent 78818ca275
commit cdac595a68
1 changed files with 6 additions and 5 deletions

View File

@ -90,6 +90,11 @@ static id s_sharedDirectorCaller;
- (void)appDidBecomeActive
{
// initialize initLastDisplayTime, or the dt will be invalid when
// - the app is lauched
// - the app resumes from background
[self initLastDisplayTime];
isAppActive = YES;
}
@ -103,10 +108,6 @@ static id s_sharedDirectorCaller;
// Director::setAnimationInterval() is called, we should invalidate it first
[self stopMainLoop];
// initialize initLastDisplayTime, or the dt of of first frame is invalid
// should init before start displayLink
[self initLastDisplayTime];
displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self selector:@selector(doCaller:)];
[displayLink setFrameInterval: self.interval];
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];