Hi, is this the right way to select the sprites folder (sd, hd and ipadhd) with the new cocos2d-x version cocos2d-2.1beta3-x-2.1.1 as we can see here:
[http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Mechanism_of_loading_resources]
The problem is that the right folder is selected once on two tries. Once on two tries the hd folder is selected instead of the sd folder :
-
Here is when the good folder is selected:
[http://fayaeditor.com/tachman/photos/720636b894b6dcc5f511bf5ee137c99ed747a958.png] -
Here is when the wrong folder is selected:
[http://fayaeditor.com/tachman/photos/9f689d222e34da0e2012caa7f02697ecfbb8219b.png]
That’s the code i use in AppDelegate.cpp bool AppDelegate::applicationDidFinishLaunching()
CCSize designSize = CCSizeMake(480, 320);
CCSize resourceSize = CCSizeMake(480, 320);
CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
std::vector searchPaths;
std::vector resDirOrders;
searchPaths.push_back("Images"); // Resources/Images
CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
if (screenSize.height > 768)
{
resourceSize = CCSizeMake(2048, 1536);
resDirOrders.push_back("ipadhd");
cout<<"ipadhd";
}
else if (screenSize.height > 640)
{
resourceSize = CCSizeMake(1536, 768);
resDirOrders.push_back("hd");
cout<<"hd";
}
else if (screenSize.height > 480)
{
resourceSize = CCSizeMake(960, 640);
resDirOrders.push_back("hd");
cout<<"hd";
}
else
{
resDirOrders.push_back("sd");
cout<<"sd";
}
CCFileUtils::sharedFileUtils()->setSearchResolutionsOrder(resDirOrders);
pDirector->setContentScaleFactor(resourceSize.width/designSize.width);
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionShowAll);
Any idea? Thanks:)