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


C++ CCEGLView::getFrameSize方法代码示例

本文整理汇总了C++中CCEGLView::getFrameSize方法的典型用法代码示例。如果您正苦于以下问题:C++ CCEGLView::getFrameSize方法的具体用法?C++ CCEGLView::getFrameSize怎么用?C++ CCEGLView::getFrameSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCEGLView的用法示例。


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

示例1: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

    pDirector->setOpenGLView(pEGLView);
	CCSize frameSize = pEGLView->getFrameSize();
	
    // 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 FK windows console
	FKCW_Base_Utils::CreateWinConsole();

	// add resouce dir
	CCFileUtils::sharedFileUtils()->addSearchPath( "Resources" );

    // create a scene. it's an autorelease object
    CCScene *pScene = BaseLayer::scene();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:duzhi5368,项目名称:FKCocos2dxWrapper_2.x,代码行数:28,代码来源:AppDelegate.cpp

示例2: applicationDidFinishLaunching

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;
}
开发者ID:laogong5i0,项目名称:MiniGame,代码行数:34,代码来源:AppDelegate.cpp

示例3: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
    
    pDirector->setOpenGLView(pEGLView);
    
    CCSize screenSize = pEGLView->getFrameSize();
    CCSize designSize = CCSize(2048, 1536);
    
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionExactFit);
    
    if (screenSize.height > 768) {
        pDirector->setContentScaleFactor(1536/designSize.height);
    } else if (screenSize.height > 320) {
        pDirector->setContentScaleFactor(768/designSize.height);
    } else {
        pDirector->setContentScaleFactor(380/designSize.height);
    }

    // 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 = GameLayer::scene();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:DangDinhHau,项目名称:cocos2d-x-by-example-beginners-guide,代码行数:35,代码来源:AppDelegate.cpp

示例4: applicationDidFinishLaunching

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;
}
开发者ID:fengqi-wang,项目名称:TicTacToeOSX,代码行数:60,代码来源:AppDelegate.cpp

示例5: applicationDidFinishLaunching

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;
}
开发者ID:shun-tak,项目名称:cocos2d-x-programming-guide,代码行数:60,代码来源:AppDelegate.cpp

示例6: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

	//pDirector->setProjection(kCCDirectorProjection2D);
    pDirector->setOpenGLView(pEGLView);
	CCSize frameSize = pEGLView->getFrameSize();

    //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 = Demo::scene();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:anyexxx,项目名称:cocos2dx-extension,代码行数:26,代码来源:AppDelegate.cpp

示例7: applicationDidFinishLaunching

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;
}
开发者ID:danjia,项目名称:GameForMom,代码行数:59,代码来源:AppDelegate.cpp

示例8: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

    pDirector->setOpenGLView(pEGLView);
	CCSize frameSize = pEGLView->getFrameSize();
    
    // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
    TargetPlatform target = getTargetPlatform();
    if(target == kTargetIpad)
    {
        // ipad
        if(pDirector->enableRetinaDisplay(true))
        {
            // ipad hd
            CCFileUtils::sharedFileUtils()->setResourceDirectory("ipadhd");
        }
        else
        {
            CCFileUtils::sharedFileUtils()->setResourceDirectory("ipad");
        }
    }
    else if(target == kTargetIphone)
    {
        // iphone
        if(pDirector->enableRetinaDisplay(true))
        {
            if(pDirector->getWinSize().width > 480)
            {
                // iphone hd 4'
                CCFileUtils::sharedFileUtils()->setResourceDirectory("iphone");
            }
            else
            {
                // iphone hd 3'
                CCFileUtils::sharedFileUtils()->setResourceDirectory("iphone");
            }
        }
    }
	
    // 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;
}
开发者ID:haxpor,项目名称:ObjectAL-CppWrapper,代码行数:55,代码来源:AppDelegate.cpp

示例9: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
	//pEGLView->set(1024,768);
    pDirector->setOpenGLView(pEGLView);

    // Set the design resolution
    //pEGLView->setDesignResolutionSize(320,480, kResolutionShowAll);
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(320, 480, kResolutionNoBorder);

	CCSize frameSize = pEGLView->getFrameSize();

    // 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 0
    // if the frame's height is larger than the height of medium resource size, select large resource.
	if (frameSize.height > mediumResource.size.height)
	{ 
		CCFileUtils::sharedFileUtils()->setResourceDirectory(largeResource.directory);
        pDirector->setContentScaleFactor(largeResource.size.height/designResolutionSize.height);
	}
    // if the frame's height is larger than the height of small resource size, select medium resource.
    else if (frameSize.height > smallResource.size.height)
    { 
        CCFileUtils::sharedFileUtils()->setResourceDirectory(mediumResource.directory);
        pDirector->setContentScaleFactor(mediumResource.size.height/designResolutionSize.height);
    }
    // if the frame's height is smaller than the height of medium resource size, select small resource.
	else
    { 
		CCFileUtils::sharedFileUtils()->setResourceDirectory(smallResource.directory);
        pDirector->setContentScaleFactor(smallResource.size.height/designResolutionSize.height);
    }
#else
		CCFileUtils::sharedFileUtils()->setResourceDirectory(winResource.directory);
        //pDirector->setContentScaleFactor(largeResource.size.height/designResolutionSize.height);
#endif
    // 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();
	
	CCScene *pScene = SysMenu::scene();
    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:handongpu16,项目名称:DaFeiJi,代码行数:55,代码来源:AppDelegate.cpp

示例10: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
    
    pDirector->setOpenGLView(pEGLView);
    
    CCSize screenSize = pEGLView->getFrameSize();
    CCSize designSize = CCSize(2048, 1536);
    
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionExactFit);
	std::vector<std::string> searchPaths;

    if (screenSize.height > 768) {
		searchPaths.push_back("ipadhd");
		CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
        pDirector->setContentScaleFactor(1536/designSize.height);
    } else if (screenSize.height > 320) {
		searchPaths.push_back("ipad");
		CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
        pDirector->setContentScaleFactor(768/designSize.height);
    } else {
		searchPaths.push_back("iphone");
		CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
        pDirector->setContentScaleFactor(380/designSize.height);
    }
    
	SimpleAudioEngine::sharedEngine()->preloadBackgroundMusic(CCFileUtils::sharedFileUtils()->fullPathForFilename("background.mp3").c_str());
	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("falling.wav").c_str());
	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("hitBuilding.wav").c_str());
	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("jump.wav").c_str());
	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("crashing.wav").c_str());
	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("start.wav").c_str());
	SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("openUmbrella.wav").c_str());
    
    SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(0.5f);
    SimpleAudioEngine::sharedEngine()->setEffectsVolume(0.5f);
    
    
    // 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 = GameLayer::scene();

    // run
    pDirector->runWithScene(pScene);

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

示例11: applicationDidFinishLaunching

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;
}
开发者ID:xiayouli0122,项目名称:MaJong,代码行数:53,代码来源:AppDelegate.cpp

示例12: applicationDidFinishLaunching

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, kResolutionExactFit);
    CCSize frameSize = pEGLView->getFrameSize();
    std::vector<std::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.
    float scaleFactor = 1.0f;
    if (frameSize.height > mediumResource.size.height) {
        searchPath.push_back(largeResource.directory);
        scaleFactor = 4.0f;
    }
    // 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);
        scaleFactor = 2.0f;
    }
    // if the frame's height is smaller than the height of medium resource size, select small resource.
    else {
        searchPath.push_back(smallResource.directory);
        scaleFactor = 1.0f;
    }
    pDirector->setContentScaleFactor(scaleFactor);
    
    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
    
    // Init the view port with the frame size and scale factor
    this->initializeViewPort(frameSize, scaleFactor);
    
    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);
    
    // Initialize Nextpeer
    this->initializeNextpeer();
    
    // run
    pDirector->runWithScene(MainMenuLayer::scene());
    
    return true;
}
开发者ID:diorsman,项目名称:Nextpeer-UFORUN,代码行数:51,代码来源:AppDelegate.cpp

示例13: applicationDidFinishLaunching

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 > mediumResource.size.height)
    {
        // [L]ディレクトリのソースを使用
        searchPath.push_back(largeResource.directory);
        pDirector->setContentScaleFactor(MIN(largeResource.size.height / designResolutionSize.height, largeResource.size.width / designResolutionSize.width));
    }
    else if (frameSize.height > smallResource.size.height)
    {
        // [M]ディレクトリのリソースを使用
        searchPath.push_back(mediumResource.directory);
        pDirector->setContentScaleFactor(MIN(mediumResource.size.height / designResolutionSize.height, mediumResource.size.width / designResolutionSize.width));
    }
    else
    {
        // [S]ディレクトリのリソースを使用
        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 for debug
    //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 = TitleScene::scene();

    // run
    pDirector->runWithScene(pScene);

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

示例14: applicationDidFinishLaunching

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;
}
开发者ID:mkanakureon,项目名称:harajuku_aa,代码行数:46,代码来源:AppDelegate.cpp

示例15: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
  CCDirector* director = CCDirector::sharedDirector();
  CCEGLView* EGLView = CCEGLView::sharedOpenGLView();
  CCSize  screenSize = EGLView->getFrameSize();

  director->setOpenGLView(EGLView);
  director->setContentScaleFactor(designResolutionSize.height / screenSize.height);

  vector <string> searchPath;

  searchPath.push_back(resources800x600.directory);

  CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);

  mSharedScreenManager = ScreenManager::create();

  Options::SCREEN_WIDTH = designResolutionSize.width;
  Options::SCREEN_HEIGHT = designResolutionSize.height;

  Options::SCREEN_CENTER_X = designResolutionSize.width / 2;
  Options::SCREEN_CENTER_Y = designResolutionSize.height / 2;

  Options::CAMERA_WIDTH = screenSize.width;
  Options::CAMERA_HEIGHT = screenSize.height;

  Options::CAMERA_CENTER_X = screenSize.width / 2;
  Options::CAMERA_CENTER_Y = screenSize.height / 2;

  director->setAlphaBlending(false);
  director->setDepthTest(false);

  director->setDisplayStats(true);

  director->setProjection(kCCDirectorProjection2D);

  director->setAnimationInterval(1.0f / 60.0f);

  director->runWithScene(Loader::create());

  return true;
}
开发者ID:tooflya,项目名称:real-steel,代码行数:42,代码来源:AppDelegate.cpp


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