Reputation: 22042
I used Cocos2d:
-hd.png for iPhone HD
-ipad.png for iPad.
-ipadhd.png for iPad HD.
Like this which extension we need to use for iPhone 5 ? Also how to enable iPhone 5 support in cocos2d ?
UPDATE 1: Easily we can support iPhone5 like this
#define IS_IPHONE5 (([[UIScreen mainScreen] bounds].size.height-568)?NO:YES)
#define TEX_GAME_BG (IS_IPHONE5) ? ( @"bg-whd.png") : ( @"bg.png")
mBG1 = [CCSprite spriteWithFile:TEX_GAME_BG];
UPDATES 2: Use general function...put this in cocos2d.h or any common file
static inline NSString *i5res(NSString * data)
{
if(IS_IPHONE5)
{
return [data stringByReplacingOccurrencesOfString:@"." withString:@"-whd."];
}
return data;
}
//usage
CCSprite *bg = [CCSprite spriteWithFile:i5res(@"bg.png")];
UPDATES 3: Cocos2d now support iphone5 also. -iphone5hd
imageName-iphone5hd.png for iPhone 5 HD.
Upvotes: 5
Views: 2198
Reputation: 1408
There is a way to get this work, you have to update the CCFileUtils files in the cocos2d (v2.0) framework. Check this link, files and info is there
http://www.cocos2d-iphone.org/forum/topic/39491/page/4
Upvotes: 1
Reputation: 8749
There is no extension for iPhone5 size images in cocos2d. If you need to use images like this you will have to load them yourself.
Perhaps also think of how you could avoid the images altogether. If you are using background images, maybe you could use a tiled image instead?
To enable iPhone 5 support is the same as any iOS project, just add the [email protected] launch image to your project.
Upvotes: 3