简体   繁体   中英

app frame rate is unstable

Hi all writing an app for iphone using cocos2d and objective c. i have my frame rate set at 30 fps with [[CCDirector sharedDirector] setAnimationInterval:1.0/30]; this is fine for awhile but at 1 point in the app the frame rate increases to between 60-90 fps on simulator when swapping between 2 scenes. i put a break point in to get the animationInterval value and it always says it is 0.033 so why would the frame rate be spiking like this? i have been using [[CCDirector sharedDirector] stopAnimations]; and [[CCDirector sharedDirector] startAnimations]; when swapping layers and scenes but i always reset the the interval value when i start it again. any help would be appreciated thanks

this is the exact point when the fps goes nuts. when the gamescene is loaded

[[CCDirector sharedDirector] stopAnimation];
GameScene *gameScene = [GameScene node];
[[CCDirector sharedDirector] replaceScene:gameScene];
[[CCDirector sharedDirector] startAnimation];
[[CCDirector sharedDirector] setAnimationInterval:1.0/30];
CCDirector *director = [CCDirector sharedDirector];
[director setAnimationInterval:1.0/60];
[director setDisplayFPS:YES];

Try this to get the exact interval in frames.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM