在通用 iOS 应用程序中管理资源

发布于 2025-01-01 10:56:19 字数 153 浏览 5 评论 0原文

我正在开发一个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?

Thanks and Best regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夜空下最亮的亮点 2025-01-08 10:56:19

至于建议:为Retina设备和iPad提供高清分辨率图像,为非Retina设备提供标清分辨率图像。不要考虑一种一体化的解决方案——没有一个是可以接受的。

  1. 请勿在 Retina 设备或 iPad 上将标清图像升级为高清分辨率。它不会看起来更好。

  2. 不要缩小非 Retina 设备的高清图像。在具有一半甚至四分之一可用内存的设备上,您的纹理仍将使用 4 倍的内存。此外,缩小图像尺寸也不利于性能,因为它必须由旧设备上的 CPU 来完成。虽然您可以缩小图像并保存缩小后的纹理,但这会增加代码的复杂性并增加加载时间。

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. Don't upscale SD images to HD resolution on Retina devices or iPad. It won't look any better.

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

挖个坑埋了你 2025-01-08 10:56:19

这个问题没有唯一的正确答案。一种方法是创建比您需要的更大的图像,然后将其缩小。如果图像没有很多细节,那应该效果很好。例如,这就是您将应用程序图标的 512x512 像素图像与应用程序一起提交到 App Store 的原因。 Apple 从来不会以该尺寸显示图像,而是使用它来创建各种较小尺寸以在 App Store 中显示。

另一种方法是使用矢量图像,您可以按照您需要的任何尺寸完美地绘制矢量图像。不幸的是,我能想到的 iOS 中唯一支持的矢量格式是 PDF。

There's not a single right answer to this question. One way to do it is to create images that are larger than you need and then scale them down. If the images don't have a lot of fine detail, that should work pretty well. As an example, this is the reason that you submit a 512x512 pixel image of your app icon along with your app to the App Store. Apple never displays the image at that size, but uses it to create a variety of smaller sizes for display in the App Store.

Another approach is to use vector images, which you can draw perfectly at any size that you need. Unfortunately, the only vector format that I can think of that's supported in iOS is PDF.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文