• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ runWithScene函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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("Battle of Stars", Rect(0, 0, developmentResolutionSize.width, developmentResolutionSize.height));
        // XXX: Full Screen Here!
        // glview =  GLViewImpl::createWithFullScreen("ball");
#else
        glview = GLViewImpl::create("Battle of Stars");
#endif
        director->setOpenGLView(glview);
    }

    // turn on display FPS
    director->setDisplayStats(false);

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

    FileUtils::getInstance()->addSearchPath("res");
    
    // create a scene. it's an autorelease object
    //auto scene = MenuScene::createScene();
    auto scene = TransitionFade::create(1.0f, BeginScene::createScene());
    // run
    director->runWithScene(scene);

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


示例17: Rect

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::createWithRect("SushiNeko", Rect(0, 0, 640, 960));
        director->setOpenGLView(glview);
    }
    
    glview->setDesignResolutionSize(640, 960, ResolutionPolicy::FIXED_WIDTH);
    
    // 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);

    FileUtils::getInstance()->addSearchPath("res");
    
    std::vector<std::string> searchResolutionsOrder(1);
    
    cocos2d::Size targetSize = glview->getFrameSize();
    
    if (targetSize.height < 481.0f)
    {
        searchResolutionsOrder[0] = "resources-1x";
    }
    else if (targetSize.height < 1137.0f)
    {
        searchResolutionsOrder[0] = "resources-2x";
    }
    else if (targetSize.height < 2047.0f)
    {
        searchResolutionsOrder[0] = "resources-3x";
    }
    else
    {
        searchResolutionsOrder[0] = "resources-4x";
    }
    
    FileUtils::getInstance()->setSearchResolutionsOrder(searchResolutionsOrder);
    
    // create a scene. it's an autorelease object
    auto scene = MainScene::createScene();

    // run
    director->runWithScene(scene);

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


示例18: 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("Archer", Rect(0, 0, designResolutionSize.width, designResolutionSize.height));
#else
        glview = GLViewImpl::create("Archer");
#endif
        director->setOpenGLView(glview);
    }

    // turn on display FPS
    director->setDisplayStats(false);

    // 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 = Size(1280,720);
	//资源大小;
	auto resourceSize = Size(1280, 720);
	std::vector<std::string> searchPaths;

	if (screenSize.height > 720) {	//640x1136
		designSize = Size(1920, 1080);
		searchPaths.push_back("picture");
	}
	else {
		searchPaths.push_back("picture");
	}

	director->setContentScaleFactor(resourceSize.width / designSize.width); //默认为1.0f

	FileUtils::getInstance()->setSearchPaths(searchPaths);

	glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER);


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

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:MulticsYin,项目名称:Archer-cocos2d-x,代码行数:50,代码来源:AppDelegate.cpp


示例19: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
	auto director = Director::getInstance();
	auto glview = director->getOpenGLView();
	if (!glview) {
		glview = GLViewImpl::create("Breakout");
		glview->setFrameSize(1000, 550);	
		director->setOpenGLView(glview);
	}

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

	return true;
}
开发者ID:hsibayan,项目名称:-GAMEDEV--Breakout,代码行数:14,代码来源:AppDelegate.cpp


示例20: if

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create("DemoTest");
		//glview->setFrameSize(1334, 750);
		//glview->setContentScaleFactor(2);
		//glview->setDesignResolutionSize(960, 512, ResolutionPolicy::FIXED_WIDTH);
        director->setOpenGLView(glview);
    }

    // turn on display FPS
    director->setDisplayStats(false);

    // 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(1334,750, ResolutionPolicy::NO_BORDER);
    //glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
	//director->setContentScaleFactor(3.2);
   /* 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 = MenuScene::createScene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:chenqian89614,项目名称:xiaoxin,代码行数:49,代码来源:AppDelegate.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ run_cmd函数代码示例发布时间:2022-05-30
下一篇:
C++ runTorchNet函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap