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

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!

 

 

posted on 2012-08-17 17:10  dqshll  阅读(168)  评论(0编辑  收藏  举报

导航