Ok, I figured it out. Your atlas .png file must have an extension -hd but all images must NOT!
I've created two folders, "1x" and "2x" and I copied all normal resolution images into the 1x and retina images into the 2x folder. For example:
1x/hero.png (has dimensions 20x20px)
2x/hero.png (has dimensions 40x40px)
Then I created two atlas files and one of them has a -hd extension:
GameAtlas.zssxml
GameAtlas-hd.zssxml
The size of GameAtlas.zssxml is 1024x1024 and the size of GameAtlas-hd.zssxml is 2048x2048. I then imported all graphics from 1x folder into the GameAtlas.zssxml and all from 2x into the GameAtlas-hd.zssxml.
As export I got these four files:
GameAtlas.plist
GameAtlas.png
GameAtlas-hd.plist
GameAtlas-hd.png
Then you need to copy all these four files into your Resources folder.
You then never use -hd suffix if you are creating a CCSprite.
// Load GameAtlas (Do only once on initialization)
[CCSpriteFrameCache purgeSharedSpriteFrameCache];
[CCTextureCache purgeSharedTextureCache];
CCSpriteFrameCache* frameCache = [CCSpriteFrameCache sharedSpriteFrameCache];
[frameCache addSpriteFramesWithFile:@"GameAtlas.plist"];
// Create a CCSprite (Do each time you need to create a sprite)
CCSprite *heroSprite = [CCSprite spriteWithSpriteFrameName:[NSString stringWithString:@"hero.png"]];
- Kenan.