Skip to content Skip to sidebar Skip to footer

Cannot Create Ccsprite With Subfolder Png When Port To Android Application With Cocos2d-x?

I met the problem I cannot create CCSprite in cocos2d-x Android. I have a xml file which store the file path. And I read the file path to create a Sprite. The Sprite is NULL. CCSpr

Solution 1:

You have to add sub directories to your search path in cocos-2dx, You can do this in your AppDelegate::applicationDidFinishLaunching() method before loading any scene.

int i = 0;
CCFileUtils *fileUtils = CCFileUtils::sharedFileUtils();
std::vector<std::string> searchPaths = fileUtils->getSearchPaths();
searchPaths.insert(searchPaths.begin() + i++, "withword");
fileUtils->setSearchPaths(searchPaths);

Post a Comment for "Cannot Create Ccsprite With Subfolder Png When Port To Android Application With Cocos2d-x?"