2
votes

I'm developing a game using cocos2d. It's running now on iPhone and also supports Retina display. With retina i'm using images with "-hd" postfix. Now i want my application to be able to work on iPad using this images. How can i do that ?

PS: I don't have a real iPad and can only use a simulator. I will test the game on my friend's iPad after it will work well on a simulator. Is it possible to use hi-res images with simulator and how to do it?

I'm using cocos2D 0.99.5

2
The short answer is yes, the long answer is it's not as simple as you would expect. I am not an expert, so will refrain from answering. If you search the cocos2d forums, you can find the information you are looking for.Jeff B
Agree with the above.. You have to edit the cocos2d codes.. I mean the cocos2d engine codes.. Like how it reads the file.. and loads the hd images instead..xuanweng

2 Answers

3
votes

inside CCFileUtils.m

inside method name +(NSString*) getDoubleResolutionImage:(NSString*)path

edit if( CC_CONTENT_SCALE_FACTOR() == 2) to if( CC_CONTENT_SCALE_FACTOR() == 2 || (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad))

this will make the app to load the -hd image when running on ipad, remember to change your app targeted device family to iPhone/iPad.

this will solve the loading of -hd problem for ipad.

but after loading -hd file for ipad resolution, you will also notice that most of your image position should be off alignment, now either you go directly into the cocos2d folder to edit how CCNode,CCSprite,CClabel handle the positioning of thing or you code it in your code checking if its ipad or not.

if you are using CCSpriteBatchNote. this will also cause another problem because you will be reading from the -hd SpriteSheet. so the texture Rect u set to cut need to be double too.

another method is position everything according to winsize. i haven try this method.

0
votes

I don't exactly understand the question but I will try to answer.

You can technically use the same graphics for the iPad, but they will not look as nice. For one, they will all blurry and pixelated, and two, the iPad has a different screen aspect ratio that the iPhone/iPod Touch. If you do make separate images for an iPad version of your game, it will not be extremely difficult to do. If you want to do this, I suggest posting a new question.