创建图像缓存 - 大 png 图像
我是第一次发海报。我有一个对很多人来说似乎很常见的问题,但我似乎无法在任何地方找到或破译答案。
我正在制作的游戏在屏幕上有 3 个相当大的精灵(230 高)x 不同的宽度。 每个精灵都有 3 个 1024x1024 的角色表,动画帧取自其中。
我尝试过 PVR,但在那个尺寸上它们绝对是可怕的,所以我想保留 PNG。
从其他信息来看,我相信该设备可以在内存中处理 3 个 1024x1024 PNG,而不会出现内存警告。
我的问题是我最终得到了 9 ,就好像我不使用 imagenamed 一样,那么从磁盘加载纸张所需的时间是不可接受的。
我创建了一个 NSMutableDictionary 来存储 png 图像表中的数据,但这就是我的问题。
如何在不使用 imagenamed 的情况下将未压缩的 png 数据添加到 NSMutableDictionary 中?如果我将其添加到未压缩的(带有文件内容的图像)中,那么当我从缓存中获取图像时,仍然需要大量的加载时间。
我需要以某种方式将其未压缩地存储在 NSMutableDictionary 中 - 将其分配给精灵的图像(精灵是 UIImageViews),这样它就不会像我使用 imageNamed 那样被存储。
如果我需要更改精灵从中抓取帧的工作表,请将 png 从纹理内存中完全释放。 (不是来自我的 NSMutableDictionary 缓存)
提前致谢 -
I am a first time poster. I have a problem that seems very common to a lot of people but I can't seem to find or decipher an answer anywhere.
The game I'm making has 3 rather large sprites on screen (230 high) x various widths.
Each sprite has 3 1024x1024 character sheets where the frames of animations are taken from.
I've experimented with PVR's but at that size they are absolutely horrible so I want to keep PNG's.
From other information I believe that the device can handle 3 1024x1024 PNGs in memory without memory warnings.
My problem is I end up with 9 as if I don't use imagenamed then the time it takes to load the sheet from disk is unacceptable.
I have created a NSMutableDictionary to store the data from the png image sheets into, but here lies my problem.
How do I add uncompressed png data to the NSMutableDictionary without using imagenamed? If I add it in uncompressed (imagewithcontents of file) then there is still a massive loading time when I get the image from the cache.
I need to somehow store it uncompressed in the NSMutableDictionary - Assign it to the image of the sprite (sprites are UIImageViews) so that it doesn't get stored as it does if I use imageNamed.
Completely free the png from texture memeory if I need to change the sheet the sprite is grabbing the frames from. (not from my NSMutableDictionary cache)
thanks in advance -
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论