Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement HD "Retina Display" graphics in Cocos2D

I am not quite sure how use HD images for sprites in cocos2d. I looked through the documentation, and downloaded the newest beta which supports points instead of pixels, but I don't understand the whole -hd suffix idea. In other word I need help and have no idea how to use retina quality graphics in my cocos2d game. I feel that it is very simple, but I cannot find anything on doing this. Any help would be greatly appreciated.

Ok so maybe this is asking too much but, it would be very helpful if someone could give me the code a tell me where to put it. (Thats probably too much to ask) But if it is a line or too, it would be great if you could post it. I am absolutely clueless here. One thing I did try, was to set the content scale factor. The image was hi-def, but the fps went way down to around 12fps on an iPod touch 4th gen. I really do not understand this.

Thanks,

Tate

like image 353
tallen11 Avatar asked Oct 16 '10 22:10

tallen11


2 Answers

If you're using the latest beta, the only change you should need to make is export all your images at twice the size and use the "-hd" suffix, similar to Apple's "@2x". The documentation also says you need to set the content scale factor of the director, but in my case I didn't seem to need to do that.

Though it sounds like you've already read through it, I'll link to the documentation in hopes that someone will benefit.

like image 131
Cory Kilger Avatar answered Oct 12 '22 10:10

Cory Kilger


I think the "-hd" is for Cocos2D-iPhone, the "@2x" is for icons used by Apple (e.g. Default.png).

If you want to see the difference, 1) setup slightly diff images (e.g diff colour, add minor changes) between normal and the "-hd" version, then 2) run it in simulator with "iPhone" (for iPhone 3 GS) and then with "iPhone(Retina)" (for iPhone 4+) and you should see different one been displayed.

Hope this helps.

like image 30
New2ObjectiveC Avatar answered Oct 12 '22 10:10

New2ObjectiveC