Problems with new multi-resolution system

I’ve read through the new documentation [[http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support]] so I’m trying to implement this multi-resolution/resource setup for my game but im running into some really wonky results.

Lets make sure i’ve implemented this correctly. My sprite sheets and plists are exported into iphone/ipad/ipadhd directories, and these paths are mirrored in my AppMacros.h like the example. Then in my AppDelegate.cpp I have set EGLViews design resolution to my design resolution of 1024x768, and used the framesize to determine which resource path to use and the content scale factor, exactly like the example.

My first question and problem is: Even with all the code copied from the example it appears that cocos2d picks a completely random resource each time i build i.e. the sprite frames don’t match the texture. So I can get anywhere from oversized sprites, to undersized, to randomly tiled sprites or no sprites at all. And yes they appear different EACH time i build. What have I done wrong?

My second question is: How has the function of points changed? Using director->getWinSize(), regardless of device I always get my design resolution of 1024x768. Does this mean I now treat my entire coordinate system the same regardless of device? Because before when using box2d i would need a PTM_RATIO of 32 on ipad, and 16 on ipod in conjunction with points to position everything the same, but now I can just use one right?

Thanks in advance for the help let me know if I’ve left out any key details!

EDIT: I dont know if this helps, but after some digging, the problem might be here
@
std::string CCFileUtilsIOS::getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename)
{
if (strDirectory[0] != ‘/’)
{
NSString* fullpath = [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:strFilename.c_str()]
ofType:nil
inDirectory:[NSString stringWithUTF8String:strDirectory.c_str()]];
if (fullpath != nil) {
return [fullpath UTF8String];
}
}
else
{
std::string fullPath = strDirectory+strFilename;
// Search path is an absolute path.
if ([s\_fileManager fileExistsAtPath:[NSString stringWithUTF8String:fullPath.c\_str()]]) {
return fullPath;
}
}
return “”;
}
@

When my strDirectory is “ipad/” and my strFilename is my “sprites.pvr.ccz” file, the fullPath is created Nil, when it goes to the next search path, i.e. to the strDirectory “”, it seems to find my file at the root. What the hell is going on? somehow it doesn’t recognize my file in the ipad directory, but somehow finds a phantom version at the root, perhaps randomly choosing from my set causing the problem?

And If my file is in an ipad directory should it be finding the file at “/var/mobile/Applications/(numbers)/Test.app/sprites.pvr.ccz” ? (copied from local var) shouldn’t it be “Test.app/ipad/sprites.pvr.ccs”?

EDIT2:

It seems if i completely delete the iphone and ipadhd files, it no longer finds itself confused and picks the only option, the proper size. So how can i get it to stop jumbling between these 3 directories?

Hi James, same problem here… I can’t figure out what’s wrong… It choses different files at any build… Did you found a solution?
Thanks!

Make sure you add your resource folder as reference to your XCode project (use the second radio button in the add folder dialog, the subfolders should turn blue).
So in Xcode your resource directory should look like this:
XCodeProject
|
|- Resources (yellow folder icon)
|
|~~ipad
|~~ipadhd (blue folder icon)

Otherwise XCode will copy the contents of your resources into the root folder of your application package (and it appears that it randomly decides which one goes first)

seems to be working. thank you for the response!