现在的位置: 首页 > 综合 > 正文

[cocos2d]Build only one project to support all ios devices with cocos2d

2012年07月06日 ⁄ 综合 ⁄ 共 679字 ⁄ 字号 评论关闭

There are 4 resolution ios devices currently: iphone, iphone 4(s), ipad1/2, new ipad, feel painful about this? don't tell your feeling to android developers.

in cocos2d, just use suffix to the image files or atlas as below rules:

static NSString *__suffixiPhoneRetinaDisplay =@"-hd"; // for iphone 4/s

static NSString *__suffixiPad =@"-ipad"; // for ipad 1, 2

static NSString *__suffixiPadRetinaDisplay =@"-ipadhd"; //for new pad

no suffix for iphone 1, 3g, 3gs

 if we have a texture named dog.png. you got a chance to draw 4 files to support 4 kinds of ios devices in a single project like this way:

dog.png   ->iphone

dog-hd.png ->iphone 4/s

dog-ipad.png  -> ipad 1, 2

dog-hdipad.png -> new ipad

and in your codes just use the name "dog.png", cocos2d can pick the right file with suffix for you.

what's a fun!

 

 

抱歉!评论已关闭.