在通用ios应用程序中管理资源 [英] Managing resources in a universal ios app

查看:100
本文介绍了在通用ios应用程序中管理资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发cocos2d游戏.我需要使其通用.问题是我想使用最少数量的图像来使通用二进制文件尽可能小.我是否有可能以某种方式使用与iPhone,Retina和iPad相同的图像?如果是,我该怎么做?图像大小和质量应该是多少?有什么建议吗?

I am developing a cocos2d game. I need to make it universal. Problem is that I want to use minimun amount of images to keep the universal binary as small as possible. Is there any possibility that I can use same images I am using for iphone, retina and iPad somehow? If yes, how can I do that? What image size and quality should it be? Any suggestion?

感谢和问候

推荐答案

建议:为Retina设备和iPad提供高清分辨率的图像,为非Retina设备提供SD分辨率的图像.不要考虑一个多合一的解决方案-没有一个可以接受的解决方案.

As for suggestions: provide HD resolution images for Retina devices and iPad, provide SD resolution images for non-Retina devices. Don't think about an all-in-one solution - there isn't one that's acceptable.

  1. 请勿在Retina设备或iPad上将SD图像升级到HD分辨率.看起来不会更好.

  1. Don't upscale SD images to HD resolution on Retina devices or iPad. It won't look any better.

不要为非Retina设备缩小HD图像的尺寸.您的纹理仍将使用具有一半或什至四分之一可用内存的设备上4倍的内存.此外,按比例缩小图像不利于性能,因为它必须由较旧设备上的CPU完成.虽然您可以缩小图像的大小并保存缩小的纹理,但它会增加代码的复杂性,并会增加加载时间.

Don't downscale HD images for non-Retina devices. Your textures will still use 4x the memory on devices that have half or even a quarter of the memory available. In addition, downscaling images is bad for performance because it has to be done by the CPU on older devices. While you could downscale the image and save the downscaled texture, it adds a lot more complexity to your code and will increase the loading time.

这篇关于在通用ios应用程序中管理资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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