Just wondering are people making @2x or -hd graphics for iPad games just incase the iPad3 has retina? Or would people consider it a risky waste of time?
iPad Retina
(15 posts) (8 voices)-
Posted 4 months ago #
-
We created our book app backgrounds at 2048x1536, and scaled down for the ipad (1024x768), retina (960x480), and old iphone display (480x320). Hopefully that will pay off if a 2x retina ipad screen is on the ipad3.
Posted 4 months ago # -
I was wondering about this too. I'm expecting that the people that a lot of people added hacks to load retina graphics when on the iPad 1/2 that will completely hose their app if the iPad 3 comes around with a retina display. It will load the iPhone retina graphics but draw them at half the size they should be.
I don't for the life of me understand why people use "-hd" instead of the "@2x" suffix that the Cocoa APIs expect. If you follow the Cocoa conventions you can add the "~iPhone" or "~iPad" bit on the end to make it load the correct resource.
iPhone non-retina "image~iPhone.png"
iPhone retina "image@2x~iPhone.png"
iPad "image~iPad.png" (can symlink this to the iPhone retina one if you want)
iPad 3 retina when that comes out "image@2x~iPad.png"If you have mixed Cocos/UIKit code you haven't caused yourself any unnecessary pain either.
Posted 4 months ago # -
I don't for the life of me understand why people use "-hd" instead of the "@2x" suffix that the Cocoa APIs expect.
I'm pretty sure this has something to do with it:
WARNING: It is NOT recommend to use the ”@2x” suffix. Apple treats those images in a special way which might cause bugs in your cocos2d application.
Posted 4 months ago # -
Well yes... and that's the whole point. You want it to treat them in a special way, and you want it to treat them in the same special way as the rest of UIKit.
Near as I can tell, the only side effect of using @2x would be that if you have @2x images in your app bundle, are running on a retina device, and don't set up Cocos2D to run in retina mode it will load the retina graphics anyway and draw them too large. I don't exactly see why you would create and add @2x graphics if you don't intend to use them however.
I've always used the @2x suffix exclusively and I can't say I've run into a single issue because of it. On our current project we should be able to support the iPad 3 pretty easily (assuming the rumors are true) just by adding the extra image scales to the build script because we followed the Apple conventions for resource loading. Like I said, existing apps that had hacked ccfileutils to load their retina assets on the iPad might be in for a bit of a nasty surprise.
Posted 4 months ago # -
I'm not saying that I disagree with you, just saying that having a (vague/non-specific) warning against using the @2x suffix in the wiki probably has a lot to do with why a lot of people are using the -hd suffix ;)
It's good to know that you have not had any issues using the @2x suffix. I agree that it doesn't make much sense to include the assets If you aren't going to enable retina mode in cocos2d, so it seems like a non-issue that the retina assets would be used even if cocos2d is not in retina mode. I've looked for a more specific explanation of why the @2x suffix wasn't recommended, and you have finally confirmed for me that there really isn't a good reason not to use it. After seeing your concerns I think I'll be using @2x from now on (should be a fun day tomorrow converting all of the -hd assets we're currently using).
I am curious though if/why there would be an issue hacking CCFileUtils to load iPhone @2x images on the iPad. Presumably a retina iPad will only bother special-casing images that have the @2x~ipad suffix, so I would not expect that using the iPhone's @2x images would cause a problem. Am I missing something?
Edit: Actually after some thought I think I understand why it will cause a problem. I guess it's because cocos2d will be in retina mode on a retina iPad if your code enables retina mode based on the device's point size (which most apps do), which will cause the images to be half sized, as you mentioned. As a temporary measure for those who have hacked their CCFileUtils, perhaps not enabling retina mode if the UI idiom is iPad would prevent this (at least until the app could be updated to include iPad retina assets)?
Posted 4 months ago # -
Yeah, it won't be so hard to add another ccfileutils hack to fix the iPad 3 retina issue, but what about all the apps already in the store that do this? Those are the ones that will be in trouble if they don't put out an update before the iPad 3 appears.
Posted 4 months ago # -
Great thing to do, if you can and if you are willing, is to make pixel art/retro style graphics-based games because then it is incredibly easy to change graphics for each device and they consume a miniscule ammount of memory (in comparison to full scale art).
For example, normally a game character would be about 64x64 to 128x128 pixels, but when you do 8bit-ish graphics they will only be 16x16 to 32x32 and then scaled to be whatever.
Just 1 set of resources and the only thing you need to change per device is the scaling and some camera/layer movement variables. :)Actual image: 16x16, Scale 1x --Only needs one image :D
Normal Display: 32x32, Scale 2x
Retina Display 64x64 , Scale 4x
iPad: 64x64, Scale 4x
Retina iPad: 128x128, Scale 8xPosted 4 months ago # -
I modified CCFileUtils to load files using the UIKit convention (@2x, ~iphone, ~ipad). It works great for me. It needs a few modifications in the rest of the codebase though.
The only problem currently is that the tool that I use for compiling sprite sheets (TexturePacker), will not allow me to auto-generate SD sprite sheets without either -hd or @2x at the end. But, with the UIKit convention, it's the platform suffix at the end of the name. I emailed the guy who makes TexturePacker and he's going to correct that.
Posted 3 months ago # -
@slembcke:
When RetinaDisplay was initially added (iOS 4.0 I think) I found many bugs with @2x resources. That's why I added the-hdsuffix (if I remember correctly, other users had issues with mixing @2x and opengl too).Perhaps on iOS 4.3 / 5.0 those issues are already solved.
It might be a good idea to test them again.
Posted 3 months ago # -
FWIW, I've gone through the project I am currently working on and renamed all of the -hd and -ipad images to use @2x and ~ipad, as well as updated CCFileUtils to look for @2x and ~ipad. I have not observed any issues so far.
Posted 3 months ago # -
Didn't see this thread was updated until now.
If you load things using ImageIO, you can sidestep all of the UIImage magic so that you can load exactly the file you asked for. The rules for @2x, ~iphone, ~ipad suffixes are simple enough to implement. Then they can be implemented like in UIKit where if the most specific version doesn't exist it will load the fallback (possibly at a different scale).
Posted 2 months ago # -
For iPhone-sized devices, is the points to pixels conversion done in iOS, or somewhere within cocos2d? I'm asking because I'm wondering if iOS will handle a similar conversion on a potentially-Retina iPad 3.
This is a great thread, thanks to everyone for their input... I've learned a lot.
Posted 2 months ago # -
Through experimentation, I think I can handle my own question. The points-to-pixels conversion is done in iOS.
You can download a hack to run the iPad simulator in double resolution (https://twitter.com/#!/rpetrich/status/175472618424643584), and cocos2d will automatically handle it as a retina device.
In other words, if you were using someSheet.png, then cocos2d will look for someSheet-hd.png. So your universal app that has someSheet, someSheet-hd, some-sheet-ipad, and some-sheet-ipad-hd spritesheets will utilize all of them very smoothly. Some code to do this:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) spriteSheetPlist = @"someSheet-ipad.plist"; else spriteSheetPlist = @"someSheet.plist";When the above code runs on either a retina iPhone or retina iPad, cocos2d will look for either someSheet-ipad-hd or someSheet-hd.
Now let's see if the iPad actually gets its resolution doubled or if I'm just chasing my own tail here.
Posted 2 months ago #
Reply
You must log in to post.