mirror of https://github.com/axmolengine/axmol.git
fix iOS deltatime (#18084)
* fix ios delta time when resumes from background * remove debug codes
This commit is contained in:
parent
78818ca275
commit
cdac595a68
|
@ -90,6 +90,11 @@ static id s_sharedDirectorCaller;
|
||||||
|
|
||||||
- (void)appDidBecomeActive
|
- (void)appDidBecomeActive
|
||||||
{
|
{
|
||||||
|
// initialize initLastDisplayTime, or the dt will be invalid when
|
||||||
|
// - the app is lauched
|
||||||
|
// - the app resumes from background
|
||||||
|
[self initLastDisplayTime];
|
||||||
|
|
||||||
isAppActive = YES;
|
isAppActive = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,10 +108,6 @@ static id s_sharedDirectorCaller;
|
||||||
// Director::setAnimationInterval() is called, we should invalidate it first
|
// Director::setAnimationInterval() is called, we should invalidate it first
|
||||||
[self stopMainLoop];
|
[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 = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self selector:@selector(doCaller:)];
|
||||||
[displayLink setFrameInterval: self.interval];
|
[displayLink setFrameInterval: self.interval];
|
||||||
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
|
||||||
|
|
Loading…
Reference in New Issue