static void printFileUtils(int fd) { FileUtils* fu = FileUtils::getInstance(); mydprintf(fd, "\nSearch Paths:\n"); auto list = fu->getSearchPaths(); for( const auto &item : list) { mydprintf(fd, "%s\n", item.c_str()); } mydprintf(fd, "\nResolution Order:\n"); list = fu->getSearchResolutionsOrder(); for( const auto &item : list) { mydprintf(fd, "%s\n", item.c_str()); } mydprintf(fd, "\nWriteble Path:\n"); mydprintf(fd, "%s\n", fu->getWritablePath().c_str()); mydprintf(fd, "\nFull Path Cache:\n"); auto cache = fu->getFullPathCache(); for( const auto &item : cache) { mydprintf(fd, "%s -> %s\n", item.first.c_str(), item.second.c_str()); } }
void AppDelegate::initResourcePath() { FileUtils* sharedFileUtils = FileUtils::getInstance(); std::string strBasePath = sharedFileUtils->getWritablePath(); #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)|| (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) sharedFileUtils->addSearchPath("res/"); #else sharedFileUtils->addSearchPath("../../res/"); #endif sharedFileUtils->addSearchPath(strBasePath + "upd/", true); }
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); }
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; }
void Global::init(){ FileUtils* fu = FileUtils::getInstance(); std::string path = fu->getWritablePath(); g_fileName = fu->fullPathFromRelativeFile("ayh_7670943822e01e", path); }