コード例 #1
0
ファイル: FileUtilsTest.cpp プロジェクト: anilgulgor/myGame
void TestSearchPath::onExit()
{
    FileUtils *sharedFileUtils = FileUtils::getInstance();

    // reset search path
    sharedFileUtils->setSearchPaths(_defaultSearchPathArray);
    sharedFileUtils->setSearchResolutionsOrder(_defaultResolutionsOrderArray);
    FileUtilsDemo::onExit();
}
コード例 #2
0
ファイル: CCApplication-linux.cpp プロジェクト: BeemoLin/daca
void Application::setResourceRootPath(const std::string& rootResDir)
{
    _resourceRootPath = rootResDir;
    if (_resourceRootPath[_resourceRootPath.length() - 1] != '/')
    {
        _resourceRootPath += '/';
    }
    FileUtils* pFileUtils = FileUtils::getInstance();
    std::vector<std::string> searchPaths = pFileUtils->getSearchPaths();
    searchPaths.insert(searchPaths.begin(), _resourceRootPath);
    pFileUtils->setSearchPaths(searchPaths);
}
コード例 #3
0
ファイル: AppDelegate.cpp プロジェクト: miyccc/quickupdate
void AppDelegate::initResourcePath()
{
    FileUtils* sharedFileUtils = FileUtils::getInstance();
    //设置SearchPaths
    std::vector<std::string> oldSearchPaths = sharedFileUtils->getSearchPaths();
    std::vector<std::string> tempPaths(oldSearchPaths);
    std::vector<std::string> searchPaths;
    searchPaths.push_back(sharedFileUtils->getWritablePath() + "upd/");
    searchPaths.push_back("res/");
    searchPaths.push_back("src/");
    
    for (int i = 0; i < tempPaths.size(); ++i) {
        searchPaths.push_back(tempPaths[i]);
    }
    
    sharedFileUtils->setSearchPaths(searchPaths);
    
//    MyUnZip::getInstance()->UnZipFile("/Users/binW/Downloads/game.zip", "/Users/binW/Downloads/", PrintfText);
}
コード例 #4
0
ファイル: AppDelegate.cpp プロジェクト: Tezika/TankDemo
bool AppDelegate::applicationDidFinishLaunching()
{

    //#if (COCOS2D_DEBUG>0)
    //    initRuntime();
    //#endif

    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        Size viewSize = ConfigParser::getInstance()->getInitViewSize();
        std::string title = "VeewoGames";
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
        extern void createSimulator(const char* viewName, float width, float height,bool isLandscape = true, float frameZoomFactor = 1.0f);
        bool isLanscape = ConfigParser::getInstance()->isLanscape();
        createSimulator(title.c_str(),viewSize.width,viewSize.height,isLanscape);
#else
        glview = cocos2d::GLViewImpl::createWithRect(title.c_str(), Rect(0,0,viewSize.width,viewSize.height));
        log(">>>>>>> enter the config");
        director->setOpenGLView(glview);
#endif
    }
    log(">>>>>>> enter the hehehehe");
    cocosbuilder::CCBReader::setResolutionScale(1);

    FileUtils* fileutils = FileUtils::getInstance();

    VeeResUpdate::getInstance()->checkLocalUpdate();

    std::vector<std::string> paths = fileutils->getSearchPaths();
    paths.insert(paths.begin(), "res");
    paths.insert(paths.begin(), fileutils->getWritablePath());
    paths.insert(paths.begin(), fileutils->getWritablePath() + "update/");
    fileutils->setSearchPaths(paths);

//    fileutils->cacheFile("xxx.ccbi", true);

    director->setAnimationInterval(1.0 / 60);

    ScriptingCore* sc = ScriptingCore::getInstance();
    sc->addRegisterCallback(register_all_cocos2dx);
    sc->addRegisterCallback(register_all_cocos2dx_extension);
    sc->addRegisterCallback(register_cocos2dx_js_extensions);
    sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
    //    sc->addRegisterCallback(jsb_register_chipmunk);
    sc->addRegisterCallback(jsb_register_system);
    sc->addRegisterCallback(JSB_register_opengl);

    sc->addRegisterCallback(register_all_cocos2dx_builder);
    sc->addRegisterCallback(register_CCBuilderReader);
    sc->addRegisterCallback(register_all_pluginx_protocols);

    sc->addRegisterCallback(register_pluginx_js_extensions);
    //    sc->addRegisterCallback(register_all_cocos2dx_ui);
    //    sc->addRegisterCallback(register_all_cocos2dx_ui_manual);
    //    sc->addRegisterCallback(register_all_cocos2dx_studio);
    //    sc->addRegisterCallback(register_all_cocos2dx_studio_manual);
    //
    //    sc->addRegisterCallback(register_all_cocos2dx_spine);
    //    sc->addRegisterCallback(register_all_cocos2dx_spine_manual);

    sc->addRegisterCallback(MinXmlHttpRequest::_js_register);
    sc->addRegisterCallback(register_jsb_websocket);
    sc->addRegisterCallback(register_jsb_socketio);

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
    sc->addRegisterCallback(JavascriptJavaBridge::_js_register);
#endif

    sc->addRegisterCallback(register_all_veewo_extension);

    //#if (COCOS2D_DEBUG>0)
    //    if (startRuntime())
    //        return true;
    //#endif

    ScriptingCore::getInstance()->start();
    auto engine = ScriptingCore::getInstance();
    ScriptEngineManager::getInstance()->setScriptEngine(engine);
    ScriptingCore::getInstance()->runScript(ConfigParser::getInstance()->getEntryFile().c_str());

    VeeResUpdate::getInstance()->checkUpdate();

    return true;
}