加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

cocos2dx setDisplayStats

发布时间:2020-12-14 19:36:17 所属栏目:百科 来源:网络整理
导读:82 -- number of draw calls 0.016 -- time it took to render the frame 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,labe
82  <-- number of draw calls 0.016 <-- time it took to render the frame 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. If you use a CCSpriteBatchNode and add 100 sprites to it,it will increase the draw call only by 1.

82 is a pretty high draw call number - depending on the game's complexity and assuming it is well optimized to reduce draw calls,the number of draw calls should be around 10 to 40. Assuming all 82 draw calls are sprites,then creating a texture atlas out of the sprite images (use TexturePacker,Zwoptex,SpriteHelper) in order to use CCSpriteBatchNode you could reduce the number of draw calls to 1. Draw calls are expensive,so it is very important to keep that number down.

The time it took to render a frame is in milliseconds. Since you need to draw a new frame every 0.016666666 seconds in order to achieve 60 frames per second (1/60 = 0,0166…) this number can tell you how close your game is to dropping below 60 fps. Yours is pretty close,you have practically no room left for additional game logic or visuals before the framerate will drop below 60 fps.

The last number is the number of frames per second. This value,like the previous one,is averaged over several frames so that it doesn't fluctuate as much (makes it hard to read).

PS: one other thing to keep in mind is that the bottom two values become misleading can not be compared for framerates below 15 fps. For example cocos2d might show 0.0 for the time it took to render a frame at such a low framerate.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读