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
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.
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.
Related
I am at the start of a new game. My last game was for the iPhone, and it had to double up for iPad.
Now with the iPhone 5 screen being larger than 4, and iPad and iPad mini, I want to program the game to display the correct size images. Is it possible to design large graphic for iPad and use the same images for iPhone (just display the image smaller when using iPhone 4 etc) or is it best to use two lots of images, iPad version and iPhone version? The problem here would be the size of the app. The App would double the download and install size as the graphics would be quite large, and this isnt something I want to do.
Is it possible to use the same xib for ipad and iphone, and then I could just get the code to detect the screen size and display the game correctly based on that?
Also, I have started the project as Cocos2d with Box2d with the latest download of Cocos2d. It starts off with just the code, should I work from the storyboard instead?
thanks
1) You cannot use single xib file for both iPhone and iPad (programmatically you can but that would screw your app).
2) While doing development using Cocos2D, my experience suggests do not use any xib or storyboard file. Else you will end up in a mess.
3) As far as the question for image size for different iOS devices is concerned, I would suggest you to go with separate images (only typical ones) for different iOS devices. If you have some buttons and simple curve based UI go for CoreGraphics so that you do not need those images. Only use images that are typical ones and use CoreGraphics for rest of the images
My cocos2D app, Forever Afloat, works perfectly fine with all the combinations until you get to iPhone 5 and iOS6!
The app display is all stretched out so that you see only the lower left corner and the rest is off the screen.
Only until you force it to autorotate, does the app begin to display at proper dimensions...
My problems can also be found at this problem cocos2D iOS 6 retina display
They asked the same question.
Any solutions?
Thanks!
cocos2d uses image with image-hd.png and not image#2x.png
Check whether you are using #2x an replace by hd
Use new version of cocos2d and here is image extension.
-wide.png for iphone 5
-widehd.png for iPhone 5 HD
-hd.png for iPhone HD
-ipad.png for iPad.
-ipadhd.png for iPad HD.
There were some issues within the AppDelegate regarding the order of calls that made the display all strange. All I did was move the initalization method to the top and it fixed everything!
I have a iPad app which is NOT modified for the new iPad with retina display. But, to my surprise(pleasant) the app is working great without any issues in the retina display iPad. The graphics are just the same. I dont even see any pixelation issues. Can some one explain me the reason behind this? Did apple do something from their end in order to get the non retina apps to work the same way in retina display iPad?
Text and framework images are in high resolution, without the explicit need of the application to do anything.
What does look different are the images you provide with your app, so if your app has a custom UI that is not retina ready, it will look bad.
The same applies to the retina iPhone. Text is displayed in a double density font, and any embedded images are also displayed x2. In most cases the only change that you make for retina displays is to add double density images, but that is optional.
Edit: This also works with iPhone apps running on the iPad, with one massive gotcha. If an iPhone only app runs on the iPad, it is displayed double density, in portrait mode. But the only way that a developer can actually get his app onto an iPad is to mark it as universal, which means that it loses this support.
I've read the documentation and googled until I couldn't google anymore, but still I cannot figure out how to make my iPhone app use the higher resolution images when displayed in "2x" mode on the iPad.
I have Icon.png Icon#2x.png and Icon-72.png and they work fine, but I don't want to have to rename all of my images. Also, the "2x" just seems to scale up pixels so text and IB objects look terrible. Is there a fix for this? Any suggestions would be greatly appreciated!
Note: This is not a universal app. I don't want to make it into a universal app. I just want it to scale up and look pretty on the ipad.
It is possible, at least in Cocos2D apps. Matt Rix does exactly this in his app Trainyard and it looks great on the iPad at 2x! He covers some of the details on his blog: Retinafy your Game.
Apple want you to write native iPad apps, so they deliberately don't support this, and there's no way to make it happen that I'm aware of.
You can register for the notification _UIClassicApplicationWillChangeZoomNotificationName and scale your graphics appropriately, i.e. by setting the rasterizationScale on the CALayer to the value returned by [[UIScreen mainScreen] scale].
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.