whichever way you do it you will have the problem of scaling (offsets and fonts), but it works for me. I dont enable retina on retina ipads :) and use my -hd textures. Also For backgrounds textures , i systematically use 1136x768 pics ... they work for all devices (cropped on 3.5 iPhones and iPads). The only catch is if you want a background texture that has a 'border' feature, you would need one per device type, and have some 'if' statements at runtime to pick the appropriate texture.
here is my AppController startup
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
[director_ enableRetinaDisplay:NO];
MPLOG(@"iPad device detected : forcing non-retina !");
[constants setAsIpad];
isIpadDevice = YES;
}
else {
isIpadDevice = NO;
if (![director_ enableRetinaDisplay:YES]) {
MPLOG(@"Retina Display Not supported");
}
else {
CGSize portrait = [CCDirector sharedDirector].winSize;
CGSize landscape = CGSizeMake(portrait.height, portrait.width);
if (landscape.width >= 568.) {
[constants setAsIphoneIpodTall];
} else {
[constants setAsIphoneIpodSmall];
}
}
}
MPLOG(@"Retina display : %@", NSStringFromBool(kIsRetina));
MPLOG(@"Scale factor : %.0f", director_.contentScaleFactor);
MPLOG(@"Screen size : {%.0f, %.0f}", kScreenWidth, kScreenHeight);
MPLOG(@"Tile size : {%.0f, %.0f}", kTileWidth, kTileHeight);
MPLOG(@"Battle mid point : %@", NSStringFromCGPoint(kBattleMidPoint));
MPLOG(@"Menu width : %4i", kMapRightMenuWidth);
// Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
// Default texture format for PNG/BMP/TIFF/JPEG/GIF images
// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
// You can change anytime.
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
if (deviceTypeIpodTall == kDeviceType) {
[GESprite setDefaultPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
MPLOG(@"Pixel resolution : RGBA8888") ;
}
else {
if (isIpadDevice) {
[GESprite setDefaultPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
MPLOG(@"Pixel resolution : RGBA8888") ;
}
else {
[GESprite setDefaultPixelFormat:kCCTexture2DPixelFormat_RGBA4444];
MPLOG(@"Pixel resolution : RGBA4444") ;
}
}
[GESprite defaultPixelFormat];
// If the 1st suffix is not found and if fallback is enabled then fallback suffixes are going to searched. If none is found, it will try with the name without suffix.
// On iPad HD : "-ipadhd", "-ipad", "-hd"
// On iPad : "-ipad", "-hd"
// On iPhone HD: "-hd"
CCFileUtils *sharedFileUtils = [CCFileUtils sharedFileUtils];
[sharedFileUtils setEnableFallbackSuffixes:NO]; // Default: NO. No fallback suffixes are going to be used
[sharedFileUtils setiPhoneRetinaDisplaySuffix:@"-hd"]; // Default on iPhone RetinaDisplay is "-hd"
[sharedFileUtils setiPadSuffix:@"-hd"]; // Default on iPad is "ipad"
[sharedFileUtils setiPadRetinaDisplaySuffix:@"-hd"]; // Default on iPad RetinaDisplay is "-ipadhd"
// Assume that PVR images have premultiplied alpha
[CCTexture2D PVRImagesHavePremultipliedAlpha:NO];
and in "constants" (hahaha)
+(void)setAsIpad {
kDeviceType = deviceTypeIpadNormal;
kIsIpad = YES;
kIsIphoneIpod = NO;
kIsIphoneIpodTall = NO;
kMapRightMenuWidth = 0;
kMapBottomMenuHeight = 0;
kTileHeight = 80.;
kTileWidth = 80.;
kScreenWidth = 1024;
kScreenHeight = 768;
kIsRetina = NO;
kScreenSize = CGSizeMake(kScreenWidth, kScreenHeight);
kScreenMidPoint = ccp(kScreenWidth / 2, kScreenHeight / 2);
kMidScreen = kScreenMidPoint;
kBattleMidPoint = ccp(kScreenWidth / 2 - kMapRightMenuWidth / 2, kScreenMidPoint.y);
}