Cocos2d and iPhone 5 Retina Support? - iphone

I would like to know how to include retina images for the iPhone 5 in cocos2d. I already have large images from the iPad version of the game. How do I do that ? Unfortunately there is not very much information on the internet, so I thought I'll ask here. I do not have a working iPhone version of the game yet.

This is built into cocos2d. Use xxx.png for standard resolution image, then provide a xxx-hd.png image and cocos2d will use that high-res version on Retina devices (including iPhone 5).
The file suffixes for iPad are -ipad and -ipadhd for Retina iPads.

Related

Iphone only app cuts of the bottom of the screen when viewed in Ipad mode (2x)

my app is very basic and looks great on the iphone but in compatability mode 2x on the ipad it does not show the same screen as on the iphone. it was built as an iphone only app and has no major graphs. this is what Apple told me. 2.10: iPhone apps must also run on iPad without modification, at iPhone resolution, and at 2X iPhone 3GS resolution
I've had the same behavior on a physical iPad 2 for an existing working iPhone-only app.
In fact, after adding for each Retina images (suffixed by #2x) a corresponding non-Retina version in the project, my app launched successfully on the iPad, without any modifications...
I'm not sure it will work for you, but might worth to try ?

Sharp images in iPhone app but grainy images in iPad app

We're using retina images in our iPhone app (i.e., double the size).
The images render great on an iPhone 4 -- sharp and crisp. However, for the same app, the images look grainy on an iPad when run in "1x" mode (i.e., iPhone app size).
The code is exactly the same for both apps. There is no iPad version. People just download the iPhone version on iPads.
Are we supposed to use different images for the iPad?
Here is the app: http://itunes.apple.com/app/dumpling/id514239919
If you download it on an iPhone and then again on an iPad, you'll see the difference.
If the app is not universal then they are rendering the iPhone version on the iPad. I'm assuming you aren't in "2X" mode so if you are on an iPad 1 or 2 your app would not be using the retina graphics so it'll look grainy. Have you tested this on an iPad 3? This should render correctly for you with the #2x images.

If I'm only supporting iPhone 4+ do I still need standard resolution assets

My application will be iOS5+ and support only iPhone 4+ so the only screens it needs to work on will be retina displays.
Do I still need to use two sets of artwork or can I stick with just #2x artwork.
If your App is only for iPhone 4 and above, you can use only #2x resources. But take into account that iPad and iPad 2 are iOS 5 compatible and don't use #2x images.

How to support both iPad and iPhone retina graphics in universal apps

Apple presented new iPad that support retina graphics.
I saw this link retina graphic in apple apps. As you can see apple just use "#2x" suffix for retina iPad display.
I have an universal app. So how to support retina in new iPad and iPhone? Will iPad retina use suffix "#2x" similar to iPad?
I just created a test app and tested.
So for devices without retina:
ImageName.png - For iPhone/iPod
ImageName~ipad.png -- For iPad
For devices with retina display:
ImageName#2x.png - For iPhone/iPod
ImageName#2x~ipad.png -- For iPad
And you can still use #2x if your iPhone high resolution image and iPad high resolution image have the same size.
To load the image just use [UIImage imageNamed:#"ImageName.png"];
I just tested it on iOS simulator for iOS 5.1, 5.0 and 4.3.
By the way why you should use #2x and nothing more.
The main thing because you shouldn't use the same graphics on iPhone and iPad, because iPhone and iPad has different size. And if you will use the same size the graphics will already done for you iPad retina display (if you previously use iPhone retina display). If you will images with different size, so you will use different image names for iPhone and iPad. So in this side you need just add #2x suffix.
That's why you should use just #2x suffix. - these are my thoughts.
I found that the iPad mini/non retina iPad hardware, not simulator, would fall back on ImageName.png, not ImageName~ipad.png as you would expect from rowwingman's answer.
Looking at the docs, referenced in another StackOverflow question by Nate, it seems as though appending the device to iphone images is the correct way to do it.
MyImage.png - Default version of an image resource.
MyImage#2x.png - High-resolution version of an image resource for devices with Retina displays.
MyImage~iphone.png - Version of an image for iPhone and iPod touch.
MyImage#2x~iphone.png - High-resolution version of an image for iPhone and iPod touch devices with Retina displays.
Image, Sound, and Video Resources

How can I determine programmatically that my app is running on an iPhone, iPad or iPhone 4?

I just finish my iPhone game using cocos2d. But before I put it on the AppStore, I'd like to make it work on iPad (which have a bigger screen) and iPhone 4 (which have a bigger resolution).
So, how can I determine programmatically that my app is running on an iPhone, iPad or iPhone 4, to be able to use the correct coordinates / images in my game?
Thanks for your help!
Between iPad and iPhone — Already answered many times.
Between iPhone and iPhone 4 — The size reported is still 320×480, so you don't need to change anything about the coordinates. Create an #2x alternative for the images if you need a high resolution UI image.