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 开发者_StackOverflowfor 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.
精彩评论