COCOS2DX Setting Resource Search Path

Source: Internet
Author: User

COCOS2DX Setting Resource Search Path

> Problem Description:

            开发一个游戏,可能有很多资源文件夹,要是每次自己添加,很麻烦?

> Solutions:

            通过调用FileUtils类方法

> Specific Solutions

Method 1: The folder path cannot be added to all resources in the program

//在Appdelegate.cpp里的applicationDidFinishLaunching()函数里添加这么几行代码:std::vector paths;//创建一个string型的容器paths.push_back("fonts");//往容器中添加图片目录所在的路径paths.push_back("image");paths.push_back("sounds");FileUtils::getInstance()->setSearchResolutionsOrder(paths);//注意这里

Method 2: All resources in the program can add a folder path

std::vector<std::string> paths;//创建一个string型的容器paths.push_back("newResources");//往容器中添加图片目录所在的路径FileUtils::getInstance()->setSearchPaths(paths);

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

COCOS2DX Setting Resource Search Path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.