[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!

 

 

你可能感兴趣的:(cocos2d)