当前位置: 首页>>代码示例>>C++>>正文


C++ runWithScene函数代码示例

本文整理汇总了C++中runWithScene函数的典型用法代码示例。如果您正苦于以下问题:C++ runWithScene函数的具体用法?C++ runWithScene怎么用?C++ runWithScene使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了runWithScene函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create("MultiResolution");
        director->setOpenGLView(glview);
    }
    
    // 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);
    
    auto screenSize = glview->getFrameSize();
    auto designSize = cocos2d::Size(SCREEN_WIDTH_RETINA, SCREEN_HEIGHT_RETINA);
    auto gameSize = cocos2d::Size(GAME_WIDTH_RETINA, GAME_HEIGHT_RETINA);
    
    std::vector<std::string> searchPaths;
    
    if(screenSize.width <= SCREEN_WIDTH_SD) {
        searchPaths.push_back("SD");
        if (PORTRAIT) director->setContentScaleFactor(SCREEN_WIDTH_SD/designSize.width);
        else director->setContentScaleFactor(SCREEN_HEIGHT_SD/designSize.height);
        cocos2d::log("Set SD Design Res");
    } else if(screenSize.width <= SCREEN_WIDTH_HD) {
        searchPaths.push_back("HD");
        if (PORTRAIT) director->setContentScaleFactor(SCREEN_WIDTH_HD/designSize.width);
        else director->setContentScaleFactor(SCREEN_HEIGHT_HD/designSize.height);
        cocos2d::log("Set HD Design Res");
    } else {
        searchPaths.push_back("RETINA");
        if (PORTRAIT) director->setContentScaleFactor(SCREEN_WIDTH_RETINA/designSize.width);
        else director->setContentScaleFactor(SCREEN_HEIGHT_RETINA/designSize.height);
        cocos2d::log("Set RETINA Design Res");
    }
    
    cocos2d::FileUtils::getInstance()->setSearchPaths(searchPaths);
    if (PORTRAIT) glview->setDesignResolutionSize(designSize.height, designSize.width, ResolutionPolicy::NO_BORDER);
    else glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER);
    
    
    register_all_packages();
    
    // create a scene. it's an autorelease object
    auto scene = HelloWorld::createScene();
    
    scene = HelloWorld::createScene();
    
    director->runWithScene(scene);
    
    return true;
}
开发者ID:hydex86,项目名称:MultiResolution-cocos2dx,代码行数:54,代码来源:AppDelegate.cpp

示例2: if

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
        glview = GLViewImpl::createWithRect("CocosRender", cocos2d::Rect(0, 0, designResolutionSize.width, designResolutionSize.height));
#else
        glview = GLViewImpl::create("CocosRender");
#endif
        director->setOpenGLView(glview);
    }

    // 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);

    // Set the design resolution
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
    glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
    auto frameSize = glview->getFrameSize();
    // if the frame's height is larger than the height of medium size.
    if (frameSize.height > mediumResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is larger than the height of small size.
    else if (frameSize.height > smallResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is smaller than the height of medium size.
    else
    {        
        director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
    }
#else
	auto frameSize = glview->getFrameSize();
	director->setContentScaleFactor(1.0f);
#endif
	
	CCLOG("frameWidth=%f, frameHeight=%f", frameSize.width, frameSize.height);
    register_all_packages();

    // create a scene. it's an autorelease object
    auto scene = HelloWorld::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:minicpp,项目名称:SpriteTest,代码行数:54,代码来源:AppDelegate.cpp

示例3: CCLOG

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();

    if(!glview) {
        glview = GLViewImpl::create("Goku Fight");
        director->setOpenGLView(glview);
		//glview->setFrameSize(320, 480);
		//glview->setFrameSize(640,960);
		//glview->setFrameSize(640, 1136);
		//glview->setFrameSize(750, 1334);
		glview->setFrameSize(1242, 2208);
		//glview->setFrameSize(480, 800);

		glview->setFrameZoomFactor(.2f);
    }

	CCLOG("FrameSize : %f  %f", Director::getInstance()->getOpenGLView()->getFrameSize().width, Director::getInstance()->getOpenGLView()->getFrameSize().height);

    // turn on display FPS
    director->setDisplayStats(false);
	director->getOpenGLView()->setDesignResolutionSize(R::Constants::WIDTH_SCREEN, R::Constants::HEIGHT_SCREEN, ResolutionPolicy::FIXED_HEIGHT);
	
	R::Constants::WIDTH_SCREEN = Director::getInstance()->getWinSize().width;

	/*Size winSize = Size(R::Constants::WIDTH_SCREEN, 800);
	Size frameSize = glview->getFrameSize();
	float widthRate = frameSize.width / winSize.width;
	float heightRate = frameSize.height / winSize.height;
	if (widthRate > heightRate)
	{
		glview->setDesignResolutionSize(winSize.width,
			winSize.height*heightRate / widthRate, ResolutionPolicy::FIXED_HEIGHT);
	}
	else
	{
		glview->setDesignResolutionSize(winSize.width*widthRate / heightRate, winSize.height,
			ResolutionPolicy::FIXED_HEIGHT);
	}*/



    director->setAnimationInterval(1.0 / 60);

    register_all_packages();

    //auto scene = HelloWorld::createScene();
	auto scene = StartScreen::createScene();
    director->runWithScene(scene);

    return true;
}
开发者ID:Coder5560,项目名称:gokufight,代码行数:53,代码来源:AppDelegate.cpp

示例4: Rect

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();

	int screenWidth = 1024;
	int screenHeight = 768;

    if(!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
        glview = GLViewImpl::createWithRect("Trench-Defence", Rect(0, 0, screenWidth, screenHeight));
#else
        glview = GLViewImpl::create("Trench-Defence");
#endif
        director->setOpenGLView(glview);
    }

    // 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);

    // Set the design resolution
    glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionExactFit);
	// glview->setDesignResolutionSize(400, 475, kResolutionExactFit);
    Size frameSize = glview->getFrameSize();
    // if the frame's height is larger than the height of medium size.
	if (frameSize.height > mediumResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is larger than the height of small size.
    else if (frameSize.height > smallResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is smaller than the height of medium size.
    else
    {        
        director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
    }

    register_all_packages();

    // create a scene. it's an autorelease object
    auto scene = HelloWorld::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:WhackingMuffin,项目名称:Trench-Defence,代码行数:53,代码来源:AppDelegate.cpp

示例5: register_all_packages

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create("My Game");
        director->setOpenGLView(glview);
    }

    // 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);

    // 2倍解像度で作れるようにした
    glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::SHOW_ALL);
    Size frameSize = glview->getFrameSize();
    director->setContentScaleFactor(2.0f);

    register_all_packages();
    
    // キャラデータ初期化
    LibraryManager::create();
    auto libraryManager = LibraryManager::getInstance();
    libraryManager->init();

    // 初期のごまーびーがいればHomeに投げる。
    if (!libraryManager->hasGotten("0001")) {
        auto scene = Tutorial::createScene();
        director->runWithScene(scene);
    }else{
        auto scene = Home::createScene();
        director->runWithScene(scene);
    }


    // run
    return true;
}
开发者ID:hazumu,项目名称:otoshi,代码行数:40,代码来源:AppDelegate.cpp

示例6: if

bool AppDelegate::applicationDidFinishLaunching() {
#ifdef SDKBOX_ENABLED
    sdkbox::PluginAdMob::init();
#endif
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
        glview = GLViewImpl::createWithRect("test", cocos2d::Rect(0, 0, designResolutionSize.width, designResolutionSize.height));
#else
        glview = GLViewImpl::create("test");
#endif
        director->setOpenGLView(glview);
    }

    // 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);

    // Set the design resolution
    glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
    auto frameSize = glview->getFrameSize();
    // if the frame's height is larger than the height of medium size.
    if (frameSize.height > mediumResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is larger than the height of small size.
    else if (frameSize.height > smallResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is smaller than the height of medium size.
    else
    {        
        director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
    }

    register_all_packages();

    // create a scene. it's an autorelease object
    auto scene = HelloWorld::createScene();
    const char* config = "{\"android\":{\"AdMob\":{\"test\":true,\"ads\":{\"gameover\":{\"type\":\"interstitial\",\"id\":\"ca-app-pub-1329374026572143/1092476511\"},\"home\":{\"width\":300,\"type\":\"banner\",\"id\":\"ca-app-pub-1329374026572143/2685130917\",\"alignment\":\"bottom\",\"height\":50}}}},\"ios\":{\"AdMob\":{\"test\":true,\"ads\":{\"gameover\":{\"type\":\"interstitial\",\"id\":\"ca-app-pub-1329374026572143/4185543717\"},\"home\":{\"width\":300,\"type\":\"banner\",\"id\":\"ca-app-pub-1329374026572143/3847466511\",\"alignment\":\"bottom\",\"height\":50}}}}}";
    sdkbox::setInitialConfig(config);
    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:boyjunqiang,项目名称:test,代码行数:52,代码来源:AppDelegate.cpp

示例7: Size

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create("My Game");
		glview->setFrameSize(640, 800);
        director->setOpenGLView(glview);
    }

    // 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);

	auto sceenSize = glview->getFrameSize();
	auto designSize = Size(640, 1173);


	std::vector<std::string> searchPaths;
	if (sceenSize.width > 640)
	{
		auto resourceSize = Size(1080, 1980);
		director->setContentScaleFactor(resourceSize.width/designSize.width);
		searchPaths.push_back("bg/hd");
	}
	else{
		searchPaths.push_back("bg");
	}
	FileUtils::getInstance()->setSearchPaths(searchPaths);

#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
	// a bug in DirectX 11 level9-x on the device prevents ResolutionPolicy::NO_BORDER from working correctly
	glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::FIXED_WIDTH);
#else
	glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::FIXED_WIDTH);
#endif


    register_all_packages();

    // create a scene. it's an autorelease object
    //auto scene = HelloWorld::createScene();
	//auto scene = SettingScene::create();
	auto scene = HeroRunLayer::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:lmb0989,项目名称:StickHero,代码行数:52,代码来源:AppDelegate.cpp

示例8: Rect

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
        glview = GLViewImpl::createWithRect("running-bears-cpp", Rect(0, 0, designResolutionSize.width/2, designResolutionSize.height/2));
#else
		glview = GLViewImpl::createWithFullScreen("running-bears-cpp");
#endif
        director->setOpenGLView(glview);
    }

    // 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.0f / 60);

    // Set the design resolution
    glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
	/*
	Size frameSize = glview->getFrameSize();
    // if the frame's height is larger than the height of medium size.
    if (frameSize.height > mediumResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is larger than the height of small size.
    else if (frameSize.height > smallResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is smaller than the height of medium size.
    else
    {        
        director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
    }
	*/

    register_all_packages();

	srand(unsigned(time(NULL)));

    // create a scene. it's an autorelease object
    auto scene = BattleField::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:Young768,项目名称:running-bears-cpp,代码行数:52,代码来源:AppDelegate.cpp

示例9: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    
    soomla::CCSoomla::initialize("customSecret");
    
    MuffinRushAssets *assets = MuffinRushAssets::create();
    
    __Dictionary *storeParams = __Dictionary::create();
    storeParams->setObject(__String::create("ExamplePublicKey"), "androidPublicKey");
    
    soomla::CCSoomlaStore::initialize(assets, storeParams);
    
    __Dictionary *profileParams = __Dictionary::create();
    __Dictionary *twitterParams = __Dictionary::create();
    twitterParams->setObject(__String::create("T8NMGwKq6USYCjZox86Bxd2RJ"), "consumerKey");
    twitterParams->setObject(__String::create("TO88J9QjIJlSGfuyfza9Ox2OgTsLc1rjcmaJknlIMuUw0T1I30"), "consumerSecret");
    
    profileParams->setObject(twitterParams, soomla::CCUserProfileUtils::providerEnumToString(soomla::TWITTER)->getCString());
    
    __Dictionary *googleParams = __Dictionary::create();
    googleParams->setObject(__String::create("833688084302-sg4q1vug2ivehp54lu86rig3p0b0q85v.apps.googleusercontent.com"), "clientId");
    
    profileParams->setObject(googleParams, soomla::CCUserProfileUtils::providerEnumToString(soomla::GOOGLE)->getCString());
    
    soomla::CCSoomlaProfile::initialize(profileParams);
    
    // initialize director
    auto director = Director::getInstance();
    
    auto glview = director->getOpenGLView();
    if(!glview) {
#if COCOS2D_VERSION > 0x00030200
        glview = GLViewImpl::create("My Game");
#else
        glview = GLView::create("My Game");
#endif
        director->setOpenGLView(glview);
    }

    // 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 = ProfileScreen::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:Ratel13,项目名称:cocos2dx-profile-example,代码行数:52,代码来源:AppDelegate.cpp

示例10: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
	std::vector<std::string> resourceOrder;
    if(!glview) {
        glview = GLViewImpl::create("7 Of Hearts");
        director->setOpenGLView(glview);
		//glview->setFrameSize(1280, 720);
		//glview->setFrameSize(800, 480);
		//glview->setFrameSize(960, 640);

		// Set the design resolution
		//glview->set
		CCSize frameSize = glview->getFrameSize();

		//if (frameSize.width >= 960)
		//{
			//resourceOrder.push_back("960X640");
		//}
		//else //if (frameSize.width < 960)
		//{
//			resourceOrder.push_back("800X480");
	//	}
		
		//FileUtils::getInstance()->setSearchPaths( resourceOrder );
		//FileUtils::getInstance()->setSearchResolutionsOrder(resourceOrder);
		director->setContentScaleFactor(frameSize.height / DESIGN_HEIGHT);
		glview->setDesignResolutionSize(DESIGN_WIDTH, DESIGN_HEIGHT, kResolutionFixedHeight);

		
    }

    // 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);
#ifdef USE_SCALE_FACTOR
	auto scaleX = glview->getFrameSize().width / DESIGN_WIDTH;
	auto scaleY = glview->getFrameSize().height / DESIGN_HEIGHT;

	Board::setScaleFactors(scaleX, scaleY);
#endif
    // create a scene. it's an autorelease object
	auto scene = Board::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:revantn,项目名称:SOH,代码行数:52,代码来源:AppDelegate.cpp

示例11: GameClientManager

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create("My Game");
        director->setOpenGLView(glview);
    }

    // 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);
    
    //add search
    FileUtils::getInstance()->addSearchPath("res/");
    FileUtils::getInstance()->addSearchPath("res/icon/");
    FileUtils::getInstance()->addSearchPath("res/scene/");
    FileUtils::getInstance()->addSearchPath("res/effect");
    FileUtils::getInstance()->addSearchPath("fg/");
    
    StatusManager::getInstance()->read();   //读取status
    HeroManager::getInstance()->read(); //读取herodata
    SkillManager::getInstance()->read();    //读取skilldata
    
    g_gameClientManager = new GameClientManager();
    g_gameClientManager->createNewGame();
    
    
    
    
    
    
    
    
    
    
    
    
    // create a scene. it's an autorelease object
    //auto scene = HelloWorld::createScene();
    
    auto scene = BattleReady_Scene::createScene();
    //auto scene = Team_Scene::createScene();
    //auto scene = MapMain_Scene::createScene();
    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:weimingtom,项目名称:SLG_GAME,代码行数:51,代码来源:AppDelegate.cpp

示例12: printf

void AppDelegate::setupMainScene() {
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        
        printf("setupMainScene\n");
        printf("glview\n");
        printf("create\n");
        
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
        glview = GLViewImpl::createWithRect("LasAlitas", Rect(0, 0, designResolutionSize.width, designResolutionSize.height));
#else
        glview = GLViewImpl::create("LasAlitas");
#endif
        director->setOpenGLView(glview);
    }
    
    // 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);
    
    // Set the design resolution
    glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
    Size frameSize = glview->getFrameSize();
    // if the frame's height is larger than the height of medium size.
    if (frameSize.height > mediumResolutionSize.height)
    {
        director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is larger than the height of small size.
    else if (frameSize.height > smallResolutionSize.height)
    {
        director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is smaller than the height of medium size.
    else
    {
        director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
    }
    
    register_all_packages();
    
    // create a scene. it's an autorelease object
    auto scene = HelloWorld::createScene();
    
    // run
    director->runWithScene(scene);
    //*/
}
开发者ID:TheWindShan,项目名称:Cocos2dx-UIKit,代码行数:51,代码来源:AppDelegate.cpp

示例13: Rect

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
	auto director = Director::getInstance();
	auto glview = director->getOpenGLView();

	if (!glview) {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
		glview = GLViewImpl::createWithRect("oop4", Rect(0, 0, 600, 600));		
		director->setOpenGLView(glview);
#else
        glview = GLViewImpl::create("oop4");
#endif
        director->setOpenGLView(glview);
	};
		
    //FPS 조절 함수
	director->setDisplayStats(true);
    director->setAnimationInterval(1.0 / 60);

	//////////원하는 크기로 화면 재설정/////////////////

	Size frameSize = glview->getFrameSize();
    // if the frame's height is larger than the height of medium size.
    if (frameSize.height > mediumResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is larger than the height of small size.
    else if (frameSize.height > smallResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is smaller than the height of medium size.
    else
    {        
        director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
    }
	
	//////////////////화면 크기에 맞게 맵을 출력/////////////////////////////
	glview->setDesignResolutionSize(375, 375, ResolutionPolicy::NO_BORDER);

    register_all_packages();

    // create a scene. it's an autorelease object
    auto scene = GameScene::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:ShinMyungJae,项目名称:proj4,代码行数:51,代码来源:AppDelegate.cpp

示例14: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
	auto director = Director::getInstance();
	auto glview = director->getOpenGLView();
	if (!glview) {
		// Title and Screen size
		glview = GLViewImpl::create("Slimes Eat Chicken Right?");
		glview->setFrameSize(600, 600);
		director->setOpenGLView(glview);
	}

	auto scene = HelloWorld::createScene();
	director->runWithScene(scene);
	return true;
}
开发者ID:bunny0318,项目名称:Snake-Game,代码行数:14,代码来源:AppDelegate.cpp

示例15: if

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create("Meone Game");
        director->setOpenGLView(glview);
    }

    // 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);

    // Set the design resolution
	glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::SHOW_ALL);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
	glview->setFrameSize(designResolutionSize.width, designResolutionSize.height);
#endif
	/*
	Size frameSize = glview->getFrameSize();
    // if the frame's height is larger than the height of medium size.
    if (frameSize.height > mediumResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is larger than the height of small size.
    else if (frameSize.height > smallResolutionSize.height)
    {        
        director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));
    }
    // if the frame's height is smaller than the height of medium size.
    else
    {        
        director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));
    }
	*/
    register_all_packages();

	this->setResourceSearchResolution();

    // create a scene. it's an autorelease object
    auto scene = LoadingScene::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:yutiya,项目名称:FlappyBird,代码行数:50,代码来源:AppDelegate.cpp


注:本文中的runWithScene函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。