bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); pEGLView->setDesignResolutionSize(Setting::g_ResolusionWidth,Setting::g_ResolusionHeight,kResolutionExactFit); CCEGLView *pView = CCEGLView::sharedOpenGLView(); pView->setDesignResolutionSize(Setting::g_ResolusionWidth,Setting::g_ResolusionHeight,kResolutionExactFit); // turn on display FPS // pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object // SceneManager::goPlay(kSceneTagMain); CCScene *pscene = CCScene::create(); logo *pLayer = logo::create(); pscene->addChild(pLayer); pDirector->runWithScene(pscene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); CCSize frameSize = pEGLView->getFrameSize(); CCLOG("ScreenSize width:%f, height:%f", frameSize.width, frameSize.height); #if (SCREEN_ORIENTATION == SCREEN_ORIENTATION_LANDSCAPE) // 横屏 float frameScale = frameSize.width/frameSize.height; #elif (SCREEN_ORIENTATION == SCREEN_ORIENTATION_PORTRAIT) // 竖屏 float frameScale = frameSize.height/frameSize.width; #else #error unknown target ORIENTATION! #endif if( frameScale < 3.0f/2.0f ) // 窄屏,屏幕宽度:高度小于3:2 { // Set the design resolution pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionShowAll); } else { // Set the design resolution pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); } //use fixed resource float fScale = MIN(designResolutionRes.size.width/designResolutionSize.width, designResolutionRes.size.height/designResolutionSize.height); // CCFileUtils::sharedFileUtils()->setResourceDirectory(designResolutionRes.directory); pDirector->setContentScaleFactor(fScale); CCLOG("setContentScaleFactor fscale: %f, res.size(%f, %f), deSize(%f, %f)", fScale, designResolutionRes.size.width, designResolutionRes.size.height, designResolutionSize.width, designResolutionSize.height); // turn on display FPS lyp 取消帧率 //pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this lyp 取消帧率 //pDirector->setAnimationInterval(1.0 / 50); // create a scene. it's an autorelease object // CCScene* pScene = CSceneInit::scene(); // CCScene* pScene = SceneLogo::scene(); CCLOG("GO TO LOGIN"); CCScene* pScene = LoadingScene::scene(TargetSceneLoginScene); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); //!< 화면의 실제 크기를 나타냅니다 //!< [화면 모니터 크기가 아닌 화면 해상도같은 크기] //!< [모니터 크기는 고정인데 해상도는 들쭉날쭉하죠] //!< [main.cpp의 해상도가 모니터 크기, 요기에 있는게 해상도 크기] pEGLView->setDesignResolutionSize(768, 1024, kResolutionExactFit); // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = HelloWorld::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); //setOrientation(kOrientationLandscapeLeft); //CCEGLView::sharedOpenGLView().setDesignResolutionSize(800.0, 480.0); pDirector->setOpenGLView(pEGLView); // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices. //pDirector->enableRetinaDisplay(true); pEGLView->setDesignResolutionSize(800,480, kResolutionShowAll); // turn on display FPS pDirector->setDisplayStats(false); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = WelcomeView::CreateScene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pEGLView->setDesignResolutionSize(480, 320, kResolutionShowAll); // create a scene. it's an autorelease object //CCScene *pScene = HelloWorld::scene(); // CCScene* pScene = GameScene::scene(); CCScene* pScene = FirstScene::scene(); //CCScene* pScene = MainGameScene::scene(); //CCScene* pScene = Particle::scene(); // run pDirector->runWithScene(pScene); return true; }
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h) { if (!CCDirector::sharedDirector()->getOpenGLView()) { CCEGLView *view = CCEGLView::sharedOpenGLView(); view->setFrameSize(w, h); // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(view); // set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line. view->setDesignResolutionSize(SCREEN_SIZE_WIDTH, SCREEN_SIZE_HEIGHT, /*kResolutionShowAll*/kResolutionExactFit); AppDelegate *pAppDelegate = new AppDelegate(); CCApplication::sharedApplication()->run(); } else { ccDrawInit(); ccGLInvalidateStateCache(); CCShaderCache::sharedShaderCache()->reloadDefaultShaders(); CCTextureCache::reloadAllTextures(); CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL); CCDirector::sharedDirector()->setGLDefaultValues(); } }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); CCSize framSize = pEGLView->getFrameSize(); CCFileUtils::sharedFileUtils()->setResourceDirectory(hongMiResource.directory); CCString mm; mm = CCFileUtils::sharedFileUtils()->getResourceDirectory(); CCLOG("curent URL: %s", mm); pDirector->setContentScaleFactor(hongMiResource.size.width/designResolutionSize.width); // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = new LoadingScene();//TestLayer::scene();// // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pEGLView->setFrameSize(480, 800); pDirector->setOpenGLView(pEGLView); // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = GameScene::create(); pEGLView->setDesignResolutionSize(480, 800, kResolutionExactFit); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); // デザインサイズの設定 pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); CCSize frameSize = pEGLView->getFrameSize(); std::vector<std::string> searchPath; if (frameSize.height > largeResource.size.height) { // iPad Retina用リソースを使用 searchPath.push_back(xlargeResource.directory); pDirector->setContentScaleFactor(MIN(xlargeResource.size.height / designResolutionSize.height, xlargeResource.size.width / designResolutionSize.width)); } else if (frameSize.height > smallResource.size.height) { // iPad用リソースを使用 searchPath.push_back(largeResource.directory); pDirector->setContentScaleFactor(MIN(largeResource.size.height / designResolutionSize.height, largeResource.size.width / designResolutionSize.width)); } else { // iPhone用リソースを使用 searchPath.push_back(smallResource.directory); pDirector->setContentScaleFactor(MIN(smallResource.size.height / designResolutionSize.height, smallResource.size.width / designResolutionSize.width)); } // リソースディレクトリを指定 CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath); // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // CocosBuilderのファイルを読み込みゲーム画面を生成する CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary(); ccNodeLoaderLibrary->registerCCNodeLoader("GameLayer", GameLayerLoader::loader()); CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary); CCNode* node = ccbReader->readNodeGraphFromFile("GameLayer.ccbi"); ((GameLayer*)node)->setAnimationManager(ccbReader->getAnimationManager()); // シーンを用意し、ゲーム画面を設置する CCScene* pScene = CCScene::create(); if (node != NULL) pScene->addChild(node); ccbReader->release(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); srand(time(NULL)); pDirector->setOpenGLView(pEGLView); // Set the design resolution pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); CCSize frameSize = pEGLView->getFrameSize(); vector<string> searchPath; // In this demo, we select resource according to the frame's height. // If the resource size is different from design resolution size, you need to set contentScaleFactor. // We use the ratio of resource's height to the height of design resolution, // this can make sure that the resource's height could fit for the height of design resolution. // if the frame's height is larger than the height of medium resource size, select large resource. if (frameSize.height > mediumResource.size.height) { searchPath.push_back(largeResource.directory); pDirector->setContentScaleFactor(MIN(largeResource.size.height/designResolutionSize.height, largeResource.size.width/designResolutionSize.width)); } // if the frame's height is larger than the height of small resource size, select medium resource. else if (frameSize.height > smallResource.size.height) { searchPath.push_back(mediumResource.directory); pDirector->setContentScaleFactor(MIN(mediumResource.size.height/designResolutionSize.height, mediumResource.size.width/designResolutionSize.width)); } // if the frame's height is smaller than the height of medium resource size, select small resource. else { searchPath.push_back(smallResource.directory); pDirector->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width)); } // set searching path CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath); // turn on display FPS pDirector->setDisplayStats(false); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = TicTacToeScene::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); pEGLView->setDesignResolutionSize(960,640,kResolutionExactFit); // turn on display FPS pDirector->setDisplayStats(false); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 25); //init resources ResourceManager::inits(); // create a scene. it's an autorelease object //CCScene *pScene = GameScene::create(); //CCLayer *pLayer = GameLayer::create(); //CCSize winSize = pDirector->getWinSize(); //CCSize layerSize = pLayer->getContentSize(); //pLayer->setPosition(ccp(winSize.width / 2 - layerSize.width / 2,winSize.height / 2 - layerSize.height / 2)); //pScene->addChild(pLayer); // run CocosDenshion::SimpleAudioEngine::sharedEngine()->playBackgroundMusic("sound/bg.mid", true); pDirector->runWithScene(LoadingScene::scene()); return true; }
bool AppDelegate::applicationDidFinishLaunching() { soundEnable = true; effectEnable = true; // SpriteFrameCache::getInstance()->addSpriteFramesWithFile("MainMenu0.plist"); // initialize director CCDirector* director = CCDirector::sharedDirector(); CCEGLView* eglView = CCEGLView::sharedOpenGLView(); director->setOpenGLView(eglView); eglView->setDesignResolutionSize(320, 480, kResolutionShowAll); // turn on display FPS //director->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this director->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object //auto scene = HelloWorld::createScene(); MainMenuController* scene = MainMenuController::create(); //auto scene = GameRunController::create(); //auto scene = AtlasSplit::createScene(); // run director->runWithScene(scene); // UIWidget* playGroundUI = cocos2d::extension::UIHelper::instance()->createWidgetFromJsonFile("PlayGroundUI.ExportJson"); //reloadSound(); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); CCEGLView* pEglView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEglView); // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); pEglView->setDesignResolutionSize(SCREEN_WIDTH, SCREEN_HEIGHT, kResolutionNoBorder); std::vector<std::string> vectorSearchPaths; vectorSearchPaths.push_back("iphonehd"); CCFileUtils::sharedFileUtils()->setSearchPaths(vectorSearchPaths); // create a scene. it's an autorelease object CCScene *pScene = GameScene::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { std::vector<std::string> searchPath; // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView( pEGLView ); // Set the design resolution pEGLView->setDesignResolutionSize( designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder ); // turn on display FPS pDirector->setDisplayStats(false); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = DefaultScene::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(CCEGLView::sharedOpenGLView()); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); //pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); //set ScaleFactor pDirector->setContentScaleFactor( 640 / designResolutionSize.width); // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // register lua engine //CCLuaEngine* pEngine = CCLuaEngine::defaultEngine(); //CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); //std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua"); //pEngine->executeScriptFile(path.c_str()); View::_gamemanager::instance()->DisplayNowScene(View::SCENE_INIT); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); pEGLView->setDesignResolutionSize(480,800,kResolutionShowAll); // turn on display FPS pDirector->setDisplayStats(true); ScriptingCore* sc = ScriptingCore::getInstance(); sc->addRegisterCallback(register_all_cocos2dx); sc->addRegisterCallback(register_all_cocos2dx_extension); sc->addRegisterCallback(register_all_cocos2dx_extension_manual); sc->addRegisterCallback(register_cocos2dx_js_extensions); sc->addRegisterCallback(register_CCBuilderReader); sc->addRegisterCallback(jsb_register_chipmunk); sc->addRegisterCallback(jsb_register_system); sc->addRegisterCallback(JSB_register_opengl); sc->addRegisterCallback(MinXmlHttpRequest::_js_register); sc->addRegisterCallback(register_jsb_websocket); sc->start(); CCScriptEngineProtocol *pEngine = ScriptingCore::getInstance(); CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); ScriptingCore::getInstance()->runScript("main.js"); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); // Set the design resolution pEGLView->setDesignResolutionSize(960, 640, kResolutionNoBorder); // In this demo, we select resource according to the frame's height. // If the resource size is different from design resolution size, you need to set contentScaleFactor. // We use the ratio of resource's height to the height of design resolution, // this can make sure that the resource's height could fit for the height of design resolution. // if the frame's height is larger than the height of medium resource size, select large resource. // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = HelloWorld::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); //デザイン解像度の設定 pEGLView->setDesignResolutionSize(640, 1136, kResolutionShowAll); // turn on display FPS pDirector->setDisplayStats(false); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object //CCScene *pScene = MainGameScene::scene(); CCScene *pScene = TitleScene::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); //Fit screen of any size pEGLView->setDesignResolutionSize(320, 480, kResolutionExactFit); pDirector->setContentScaleFactor(1); // turn on display FPS pDirector->setDisplayStats(false); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = HelloWorld::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); // Set the design resolution pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); // search path vector<string> searchPath; searchPath.push_back(R.directory); CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath); // turn on display FPS #ifdef COCOS2D_DEBUG // pDirector->setDisplayStats(true); // Helper::setHelpShown(false); #endif // create a scene. it's an autorelease object CCScene* pScene = Login::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); pEGLView->setDesignResolutionSize(800, 1280, kResolutionShowAll); // turn on display FPS //pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // Initialize global data GameGlobals::Init(); // create a scene. it's an autorelease object CCScene *pScene = MainMenu::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); //デザインサイズの設定 pEGLView->setDesignResolutionSize(designResolutionSize.width , designResolutionSize.height , kResolutionNoBorder); // リソースディレクトリの指定 std::vector<std::string> searchPath; searchPath.push_back("images"); CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath); // turn on display FPS pDirector->setDisplayStats(true); pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = GameScene::scene(); pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); // 해상도 : setOpenGLView 이후에 정의되어야 한다. pEGLView->setDesignResolutionSize(1080, 1920, kResolutionNoBorder); // turn on display FPS pDirector->setDisplayStats(false); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = Splash::scene(); // sound 강제 들고오기 // if you use SimpleAudioEngine, it must be pause SimpleAudioEngine::sharedEngine()->pauseAllEffects(); SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); CCEGLView *pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); CCSize designResolutionSize = CCSizeMake(480, 800); pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); // turn on display FPS //pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object //CCScene *pScene = TangramScene::scene(4, 0); CCScene *pScene = LoadingScene::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); pDirector->setOpenGLView(pEGLView); pEGLView->setDesignResolutionSize(640, 960, kResolutionNoBorder); // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object // CCScene *pScene = IndexPage::scene(); CCScene *pScene = HelloWorld::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); //就加了这一句,就可以把默认的图片HelloWorld.png铺满整个屏幕 // 1136/480 = 2.6 640/320 2 //1136/640 > 480/320 //1024/768 < 480/320 //注意一定要放在setOpenGLView后面 pEGLView->setDesignResolutionSize(480, 320, kResolutionFixedWidth);//高 是固定的 长度会对应的发生改变 //宽不变, 高进行相应地缩放。 // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object CCScene *pScene = HelloWorld::scene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); //FIXED_WIDTH pEGLView->setDesignResolutionSize(320, 480 , ResolutionPolicy::kResolutionShowAll); std::vector<std::string> searchPath; searchPath.push_back("image"); CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath); pDirector->setContentScaleFactor(640 / 320); // turn on display FPS pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // create a scene. it's an autorelease object auto pScene = PlayLayer::CreatScene(); // run pDirector->runWithScene(pScene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); // turn on display FPS pDirector->setDisplayStats(false); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); pEGLView->setDesignResolutionSize(SCREEN_WIDTH, SCREEN_HEIGHT, kResolutionExactFit); CCFileUtils *fileUtils = CCFileUtils::sharedFileUtils(); fileUtils->addSearchPath("fonts"); fileUtils->addSearchPath("images"); fileUtils->addSearchPath("sounds"); CCScene* scene = CCScene::create(); GameScene* layer = GameScene::create(); scene->addChild(layer); pDirector->runWithScene(scene); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector *pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); CCSize frameSize = pEGLView->getFrameSize(); pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionExactFit); if (frameSize.height > mediumResource.size.height) { pDirector->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width)); } // if the frame's height is larger than the height of small resource size, select medium resource. else if (frameSize.height > smallResource.size.height) { pDirector->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width)); } // if the frame's height is smaller than the height of medium resource size, select small resource. else { pDirector->setContentScaleFactor(MIN(smallResource.size.height/designResolutionSize.height, smallResource.size.width/designResolutionSize.width)); } // turn on display FPS //pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // register lua engine CCLuaEngine* pEngine = CCLuaEngine::defaultEngine(); CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine); CCLuaStack *pStack = pEngine->getLuaStack(); lua_State *tolua_s = pStack->getLuaState(); tolua_extensions_ccb_open(tolua_s); #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) pStack = pEngine->getLuaStack(); tolua_s = pStack->getLuaState(); tolua_web_socket_open(tolua_s); #endif #if (CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY) CCFileUtils::sharedFileUtils()->addSearchPath("script"); #endif std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("scripts/main.lua"); pEngine->addSearchPath(path.substr(0, path.find_last_of('/')).c_str()); pEngine->executeScriptFile(path.c_str()); return true; }
bool AppDelegate::applicationDidFinishLaunching() { // initialize director CCDirector* pDirector = CCDirector::sharedDirector(); CCEGLView* pEGLView = CCEGLView::sharedOpenGLView(); pDirector->setOpenGLView(pEGLView); // turn on display FPS //pDirector->setDisplayStats(true); // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); // CCSize frameSize = pEGLView->getFrameSize(); CCLOG("applicationDidFinishLaunching frameSize.width = %f frameSize.height= %f", frameSize.width,frameSize.height); if(frameSize.height/frameSize.width>1.4){ pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionFixedWidth); } else { pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionFixedHeight); } if(designResolutionSize.width == 720){ pDirector->setContentScaleFactor( smallResource_tate2.size.width / designResolutionSize.width ); //ч╕ж } else { pDirector->setContentScaleFactor( smallResource_yoko.size.width / designResolutionSize.width ); //цик } cocos2d::CCSize visibleSize = cocos2d::CCDirector::sharedDirector()->getVisibleSize(); cocos2d::CCPoint origin = cocos2d::CCDirector::sharedDirector()->getVisibleOrigin(); CCLOG("applicationDidFinishLaunching designResolutionSize.width = %f ", designResolutionSize.width); CCLOG("applicationDidFinishLaunching designResolutionSize.height = %f ", designResolutionSize.height); CCLOG("applicationDidFinishLaunching pDirector->getContentScaleFactor() = %f ", pDirector->getContentScaleFactor() ); CCLOG("applicationDidFinishLaunching visibleSize width=%f height=%f ", visibleSize.width, visibleSize.height ); CCLOG("applicationDidFinishLaunching origin x=%f y=%f ", origin.x, origin.y ); // create a scene. it's an autorelease object CCScene *pScene = HelloWorld::scene(); //CCScene *pScene = HelloWorld2::scene(); // run pDirector->runWithScene(pScene); return true; }