Cocos2D SpriteSheet动画问题,我的帧数大很多
我正在尝试使用 SpriteSheet 来运行动画。我的每个帧的尺寸为 320x480,因此我最多可以在纹理图像上放置 6 个帧。但我的动画有时由 50 到 200 帧数组成,并且所有尺寸均为 320x480。 但由于尺寸限制为 1024x1024,因此无法在纹理图像上添加这么多帧。 还有其他方法我可以尝试吗?我可以一个接一个地播放动画吗?这不会影响性能吗? 拜托,我需要建议。 最好的, 瓦伊巴夫·特卡姆。
I am trying to use SpriteSheet to run an animation. My frames are of 320x480 in size each, So I am able to put max 6 frames on the texture image. But my animation consists of frame number ranging from 50 to 200 sometimes, and all are of size 320x480.
But this much number of frames cannot be added on the Texture image as the size is restricted to 1024x1024.
Is there any other approach I can try out. Can I play one animation after the other.And won't it be hampering the performance.
Please, I need suggestions.
Best,
Vaibhav Tekam.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
呃,你已经远远超出了设备的处理能力!你必须重新考虑你想要实现的目标以及如何实现它。让我解释一下。
每个具有 32 位颜色的 1024x1024 纹理需要 4 MB 内存。如果您想要一个由 60 个全屏精灵组成的精灵动画,则需要 10 个这样的纹理。这相当于 40 MB 内存。或者 120 MB 用于包含 180 个动画帧的大写场景。
请记住,iOS 设备的 128 MB RAM 内存型号在理想条件下最多可为您的应用程序提供大约 30 MB 内存。仅使用五个 1024x1024 纹理,您就会开始遇到内存问题。 256 MB 的设备仍然只有大约 100 MB 可供您的应用程序使用。
由于它应该是一个动画,因此也不能选择加载一个纹理,并且在每 6 个图像之后,删除该纹理并加载下一个。将 1024x1024 纹理加载到内存中大约需要 1-3 秒,具体取决于设备。在此期间您的应用程序将是不负责任的。
Ugh, you're going way past what the device can handle! You'll have to reconsider what you're trying to achieve and how to achieve it. Let me explain.
Every 1024x1024 texture with 32 bit colors requires 4 MB of memory. If you want a sprite animation consisting of 60 full-screen sprites, you need 10 such textures. That makes 40 MB of memory. Or 120 MB for your upper-case scenario with 180 animation frames.
Keep in mind that the 128 MB RAM memory models of the iOS devices have about 30 MB memory available for your App, at most and under ideal conditions. You will start running into memory issues with only five 1024x1024 textures. The 256 MB devices still have only about 100 MB available for your App.
Since it's supposed to be an animation, it's also not an option to load one texture, and after every 6th image, remove that texture and load the next one. Loading a 1024x1024 texture into memory takes about 1-3 seconds depending on the device. Your App will be irresponsible during that time.