So my port from iphone to android is plugging along, but I’m stumbling today. How do I searchPath.push_back to access sub-folders for my sprites and tilemaps? What I have in mind is:
if( winSize.width <= 800 ) {
// iPad Retina here.
vector searchPath;
searchPath.push_back("normal");
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
if (scale>1){
searchPath.push_back("normal\hdpi");
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
}
else if (scale>2){
searchPath.push_back("normal\xhdpi");
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
}
}
else if( winSize.width > 800 && winSize.width<= 1500) {
vector searchPath;
searchPath.push_back("large");
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
if (scale>2){
searchPath.push_back("large\xhdpi");
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
}
else if (scale>3){
searchPath.push_back("large\xxhdpi");
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
}
}
etc etc
It’s my understanding that it first looks in it’s search path for the sprite, then keeps traveling up the folder chain until it doesn’t find anything. Is that right? If so, how do I implement it? I do have some graphics that can be shared between densities, so it seems like I’m wasting space if I save duplicate copies of them into each individual dpi folder.