How to hide FPS numbers in bottom left of screen in Cocos2d

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 03:48:45

问题


How do I get rid of the numbers in the bottom left of the screen when I am making a cocos2d game? This is probably a newb question, but still.


回答1:


There is a ShowFPS var in one of the files when you create the initial cocos project. But this should work from anywhere:

[[Director sharedDirector] setDisplayFPS:NO];



回答2:


if your app delegate.. Look for

    [director setDisplayFPS:YES];

change it to

    [director setDisplayFPS:NO];

or you can call this anywhere like the previous answer:

    [[CCDirector sharedDirector]setDisplayFPS:NO];



回答3:


Just a heads up for people checking this out at a later date (like me). setDisplayFPS is deprecated now. Use setDisplayStats instead.

[[CCDirector sharedDirector] setDisplayStats:NO];



回答4:


To show it only when compiling for debug:

#if defined (DEBUG)
[[CCDirector sharedDirector] setDisplayFPS:NO];
#endif



回答5:


in AppDelegate.cpp file, and the applicationDidFinishLaunching method

// turn on display FPS
pDirector->setDisplayStats(true); 

change true to false




回答6:


for cocos2D 3.0

[[CCDirector sharedDirector] setDisplayStats:YES];



回答7:


In appdelegate.m after didfinishlaunchingoptions.

[startUpOptions setObject:@(NO) forKey:CCSetupShowDebugStats];

setObject:@NO (It is YES by default).



来源:https://stackoverflow.com/questions/5559301/how-to-hide-fps-numbers-in-bottom-left-of-screen-in-cocos2d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!