Cocos2d 2.0 - 左下角3个数字 [英] Cocos2d 2.0 - 3 numbers on the bottom left

查看:21
本文介绍了Cocos2d 2.0 - 左下角3个数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Cocos2D 2.0 项目的屏幕左下角有 3 个数字:

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

82
0.016
60.0

60 可能是 FPS,其他两个呢?我记得,以前的 Cocos 版本只有 FPS 数字.

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

有什么线索吗?谢谢

推荐答案

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

第一个数字 (82) 是绘制调用的数量(相当高).通常,在屏幕上渲染某些东西(精灵、标签、粒子效果等)的每个节点都会将该数字增加一.绘图调用很昂贵,因此保持该数量非常重要.一种方法是批量绘制调用 - cocos2d v3 会自动执行此操作.

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.

渲染一帧所花费的时间,以秒为单位.由于您需要每 0.016666666 秒绘制一个新帧以达到每秒 60 帧(1/60 = 0,0166…),因此它只是帧速率的倒数.

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.

最后一个数字是每秒的帧数,也就是帧率,也就是 fps.该值与前一个值一样,是多帧的平均值,因此波动不大.

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.

请注意,iOS 设备始终开启 VSynch(垂直同步).游戏可以每 0.0166 秒渲染一帧 - 如果计算每帧需要 0.017 秒,则帧速率有效减半至 30 fps.您只能在具体步骤中获得 fps:60、30、20、15、12、10 ...

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 ...

由于 fps 显示是几帧的平均值,它隐藏了这一事实.因此,如果显示统计数据显示 45 fps 将是一系列帧,其中每隔一帧花费的时间超过 0.0166 秒.在 fps 数字中,最近帧的单个 fps 应该是:60、30、60、30、60、30.

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.

这篇关于Cocos2d 2.0 - 左下角3个数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆