Retina Support - What does "directory" mean?

Hi everyone!
I just followed the new 2.0.4 instructions for adding retina support. Although I set up “CCFileUtils::sharedFileUtils()->setResourceDirectory” correctly, Cocos2d seems not to load the right image file.
I’ve provided the following two files in my resources folder:

HelloWorld.png
HelloWorld-ipadhd.png

But only the first one is used, even in retina-mode. What am I missing here? Do I have to put those files in different folders (is that even possible on iOS)?
Thanks for your help!

You should put HelloWorld-ipadhd.png into the directory that passed to CCFileUtils::setResourceDirectory(), and rename it to HelloWorld.png.
We don’t use -ipadhd any more.

Hi Minggo,
thanks four reply. I’ve tried what you said:

  1. I created a new subfolder “ipadhd” in my resources folder
  2. I moved the file HelloWorld-ipadhd.png to that folder and renamed it to HelloWorld.png

On startup I set the directory to “ipadhd”. Still the “normal” image is loaded, not the high res file from my ipadhd folder.
I’m pretty sure there’s just a simple mistake I’m making…

Any ideas?

When you add the folder in Xcode make sure you select “Create folder references for any added folders”. In the project navigator the folder will also be blue instead of yellow. Otherwise Xcode dumps all the images in the root of the application and CCFileUtils::setResourceDirectory() won’t do anything

Great, that totally did the trick.

Thanks guys :slight_smile: