cocos2d 精灵重量有些奇怪
这是我的问题。空的 cocos2d 项目的大小为 3.38 MB(标准“Hello world”)。我通过“配置文件”->“分配套件”进行检查。 现在我有一个大小为 382x512 像素的 .png 图像。它将在 RAM 中扩展到 512x512(2 度)。我将此文件添加到项目中,如下所示:
CCSprite* sprite = [CCSprite spriteWithFile:@"mySprite.png"];
现在是最有趣的。 “mySprite.png”具有8888像素格式,即它必须占用512x512 = 0.5*0.5 = 0.25 MB * 4 = 1 MB(像素格式中的4 - 4字节)。我说得对吗?我想是的,但是当我检查项目重量有多少时,我发现该项目有5,54 MB,即“mySprite”已oppupied > > RAM 中有 2 MB。
我做错了什么?我该如何解决它? :/ 谢谢。
Here is my question. Empty cocos2d project has weight 3.38 MB (standart "Hello world"). I check it by the Profile->Allocate Kit.
Now I have a .png image with a size 382x512 pixels. It will be extended to 512x512 in the RAM (2 degree). I add this file to project just like this:
CCSprite* sprite = [CCSprite spriteWithFile:@"mySprite.png"];
And now the most interesting. "mySprite.png" has a 8888 pixel format, i.e. it must occupie 512x512 = 0.5*0.5 = 0.25 MB * 4 = 1 MB (4 - 4 bytes from the pixel format). Am I right? I think so, but when I checked how much the project weight, I found that the project has the 5,54 MB, i.e. "mySprite" has oppupied > 2 MB in the RAM.
What am I doing wrong? And how can I fix it? :/
Thx.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我记得在某处读到过这方面的内容。我浏览了 cocos2d 论坛并发现了这篇文章:
http://www.cocos2d-iphone.org/forum/topic/4510
你应该检查卡尔的解释,这对我来说似乎有意义:
I remember reading somewhere about this. I went through the cocos2d forums and found this post:
http://www.cocos2d-iphone.org/forum/topic/4510
You should check Karl's explanation which seems to make sense for me: