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
|
||||
{
|
||||
// initialize initLastDisplayTime, or the dt will be invalid when
|
||||
// - the app is lauched
|
||||
// - the app resumes from background
|
||||
[self initLastDisplayTime];
|
||||
|
||||
isAppActive = YES;
|
||||
}
|
||||
|
||||
|
@ -100,13 +105,9 @@ static id s_sharedDirectorCaller;
|
|||
|
||||
-(void) startMainLoop
|
||||
{
|
||||
// Director::setAnimationInterval() is called, we should invalidate it first
|
||||
// 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];
|
||||
|
|
Loading…
Reference in New Issue