简体   繁体   English

应用的帧频不稳定

[英]app frame rate is unstable

Hi all writing an app for iphone using cocos2d and objective c. 大家好,我使用cocos2d和Objective c为iPhone编写了一个应用程序。 i have my frame rate set at 30 fps with [[CCDirector sharedDirector] setAnimationInterval:1.0/30]; 我使用[[CCDirector sharedDirector] setAnimationInterval:1.0 / 30]将帧频设置为30 fps; 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. 暂时可以,但是在应用程序中的1点处,当在2个场景之间切换时,模拟器上的帧速率增加到60-90 fps。 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? 我输入一个断点来获取animationInterval值,它总是说它是0.033,所以为什么帧率会像这样尖峰? i have been using [[CCDirector sharedDirector] stopAnimations]; 我一直在使用[[CCDirector sharedDirector] stopAnimations]; and [[CCDirector sharedDirector] startAnimations]; 和[[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. 这是fps变差的确切点。 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. 尝试此操作以获取准确的帧间隔。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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