开发者

Upgrading a cocos2d iPhone game to work at iPhone4 resolution using @2x

开发者 https://www.devze.com 2023-01-29 17:30 出处:网络
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.

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 example@2x.png 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?


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)


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

0

精彩评论

暂无评论...
验证码 换一张
取 消