gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 20:35:01 25 4
gpt4 key购买 nike

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

当我加载这样的 Sprite 时:

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

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

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

最佳答案

您使用的是最新版本的cocos2d

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

如果您使用 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)

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

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

关于iphone - 使用 @2x 升级 cocos2d iPhone 游戏以在 iPhone4 分辨率下运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4410042/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com