使用 @2x 升级 cocos2d iPhone 游戏以在 iPhone4 分辨率下运行

发布于 2024-10-07 15:13:21 字数 509 浏览 0 评论 0原文

我正在尝试为 iPhone4 分辨率的游戏添加美术。我使用的图像是原始图像的两倍,并且我已在图像名称中添加了 @2x 后缀。

当我加载这样的精灵时:

 [CCSprite spritewithFile:@"example.png"];

其中 example.png 是原始图像, [email  protected] 是放大版本。在原始 iPhone 上运行时,它会加载低分辨率图像;在 iPHone4 上运行时,它会加载高分辨率图像,但图像的大小会增加一倍。因此,高分辨率图像在 iPhone4 上的显示效果与原始 iPhone 上的显示效果相同。图像上的每个像素在屏幕上占据 4 个像素。

知道为什么会发生这种情况吗?我应该做些什么来告诉应用程序不要将艺术品的大小加倍吗?

I am trying to add art to my game for the iPhone4 resolution. The images i am using are twice the original and i have added the @2x suffix to the image names.

When i load in a sprite like this:

 [CCSprite spritewithFile:@"example.png"];

where example.png is the original image and [email protected] is the scaled up version. When running on the original iPhone it loads the low res image and when running on the iPHone4 it loads the high res image, but it doubles the size of the image. So the high res image appears the same on the iPhone4 as on the original iPhone. Each pixel on the image takes up 4 pixels on the screen.

Any idea why this might be happening? Is there something I am supposed to do to tell the app not to double the size of the art?

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

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

发布评论

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

评论(2

浅沫记忆 2024-10-14 15:13:21

您使用的是最新版本的 cocos2d 吗?

整个cocos2d API已转换
到积分。以前的版本是
使用像素。

如果您使用 v0.99.4:

cocos2d v0.99.4 有 RetinaDisplay
支持,但是它需要你
使用两组不同的位置
取决于设备,因为
API 以像素为单位。 (更多

如果您使用 >= v0.99.5- RC0

但在 v0.99.5-rc0(及更新版本)中,您唯一要做的就是[...] (更多)

Are you using the latest version of cocos2d?

The entire cocos2d API was converted
to Points. Previous versions were
using Pixels.

If your using v0.99.4:

cocos2d v0.99.4 has RetinaDisplay
support, however it required you to
use two different sets of positions
depending on the device , since the
API was in Pixels. (more)

If your using >= v0.99.5-rc0

But in v0.99.5-rc0 (and newer) the only thing that you have to do is[...] (more)

雨夜星沙 2024-10-14 15:13:21

您是否阅读过“cocos2d 中的 Retina 显示”部分cocos2d for iPhone 维基? (它几乎告诉了你需要知道的一切。)

Have you read the "Retina Display in cocos2d" section of the cocos2d for iPhone wiki? (It pretty much tells you all you need to know.)

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