iphone - Cocos 2d: Images rendered on retina devices are double in size -


i new cocos 2d. kindly excuse me incase basic stuff.

i creating ccmenuitemimage images , working fine on non retina devices in case of retina device(iphone , ipad retina) images being rendered double of expected size. provided, images used retina devices twice in resolution of non retina devices. instance if button has resolution of 100 x 100 non retina devices, same button retina devices has resolution of 200 x 200(because retina devices have double resolution of non retina ones).

i using following code create ccmenuitemimage :-

ccmenuitemimage *startbutton = [ccmenuitemimage itemfromnormalimage:startbtnimg selectedimage:startbtnimg target:self selector:@selector(menubuttonaction:)];  

in case of retina devices 'startbuttonimg' have file name double resolution compared non retina devices.

to summarize when render ccmenuitemimage on retina devices, images being rendered of double size(it should not this).

kindly me in figuring out doing wrong. in advance!

this tutorial explains how have different resources iphone , ipad, both retina , not in peaceful way :) http://www.raywenderlich.com/25736/how-to-make-a-simple-iphone-game-with-cocos2d-2-x-tutorial

did forget let ccfileutils module know postfix using each of files following way?

// on iphone hd: "-hd"     ccfileutils *sharedfileutils = [ccfileutils sharedfileutils];     [sharedfileutils setenablefallbacksuffixes:no];             // default: no. no fallback suffixes going used     [sharedfileutils setiphoneretinadisplaysuffix:@"-hd"];      // default on iphone retinadisplay "-hd"     [sharedfileutils setipadsuffix:@"-ipad"];                   // default on ipad "ipad"     [sharedfileutils setipadretinadisplaysuffix:@"-ipadhd"];    // default on ipad retinadisplay "-ipadhd" 

make sure you've done it, , when initialize sprite have image resources copied applications bundle. instance, if have following code should have 4 images:

projectile.png, projectile-hd.png, projectile-ipad.png , projectile-ipadhd.png

ccsprite *projectile = [ccsprite spritewithfile:@"projectile.png"]; 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -