Cocos2d 2.0 - 3 numbers on the bottom left

梦想的初衷 提交于 2019-12-18 11:09:48

问题


I have 3 numbers on the bottom left part of the screen on my Cocos2D 2.0 project:

82
0.016
60.0

60 is probably FPS and what about the other two? As I remember, previous versions of Cocos had just the FPS number.

Any clues? thanks


回答1:


82    <-- number of draw calls
0.016 <-- time it took to render the frame, here: 1.0/60.0 = 60 fps
60.0  <-- frames per second

The first number (82) is the number of draw calls (which is fairly high). Typically each node that renders something on the screen (sprites, labels, particle fx, etc) increases that number by one. Draw calls are expensive, so it is very important to keep that number down. One way to do so is by batching draw calls - cocos2d v3 does this automatically.

The time it took to render a frame, in seconds. Since you need to draw a new frame every 0.016666666 seconds in order to achieve 60 frames per second (1/60 = 0,0166…) it's just the inverse of the framerate.

The last number is the number of frames per second aka framerate aka fps. This value, like the previous one, is averaged over several frames so that it doesn't fluctuate as much.

Note that iOS devices always have VSynch (vertical synchronization) on. A game can render a frame every 0.0166 seconds - if every frame takes 0.017 seconds to compute, the framerate is effectively halved to 30 fps. You can only have fps in concrete steps: 60, 30, 20, 15, 12, 10 ...

Since the fps display is averaged over a couple frames it hides this fact. So if the display stats show 45 fps would be a sequence of frames where every other frame took longer than 0.0166 seconds. In fps numbers the individual fps of most recent frames would have been: 60, 30, 60, 30, 60, 30.




回答2:


The top number is the number of sprites in your CCLayer, etc..

The middle is the FPS's milliseconds.

The bottom is of course your FPS! :)



来源:https://stackoverflow.com/questions/10889743/cocos2d-2-0-3-numbers-on-the-bottom-left

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