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


C++ CCDirector::setContentScaleFactor方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: applicationDidFinishLaunching

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

    //default
    //CCSize designSize = CCSizeMake(480, 320);
    CCSize designSize = CCSizeMake(450, 680);
    
    std::vector<std::string> searchPaths;
    
    //TODO create the different image resolutions
    if (screenSize.height > designSize.height)
    {
    	CCLOG("using high res sd");
        searchPaths.push_back("hd");
        searchPaths.push_back("sd");
        pDirector->setContentScaleFactor(designSize.height/640.0f);

    }
    else
    {
    	CCLOG("using low res sd");
        searchPaths.push_back("sd");
        pDirector->setContentScaleFactor(designSize.height/640.0f);
    }
    
    CCLOG("screen size %f x %f", screenSize.width, screenSize.height);

    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
    
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionShowAll);
#else
	CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionShowAll);
#endif

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

    CCScene *pScene;
    
    if(cocos2d::CCUserDefault::sharedUserDefault()->getStringForKey("username") == "") {
        //create a scene. it's an autorelease object
        pScene = IntroScene::create();
    } else {
        pScene = GameLayer::scene();
    }
    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:quimnuss,项目名称:battlechess,代码行数:59,代码来源:AppDelegate.cpp

示例6: 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

示例7: 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

示例8: setupScreenResolution

/**
 * Setup the screen resolution acoording to the device.
 * Set the resources search directory.
 */
void FWGame::setupScreenResolution()
{
    CCDirector *pDirector = CCDirector::sharedDirector();
    CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
    std::vector<std::string> searchPaths;
    
    // Set
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)     // iOS platform
    
    if (m_device->isIPhoneRetina())
    {
        CCLOG("is iphone retina.");
        //3.5-inch
        searchPaths.push_back("./images/iphonehd");  //Resources/Published-iOS/resources-iphonehd
        
        CCEGLView::sharedOpenGLView()->setDesignResolutionSize(FWD_IPHONE_LANDSCAPE_WIDTH,
                                                               FWD_IPHONE_LANDSCAPE_HEIGHT,
                                                               kResolutionNoBorder);
        pDirector->setContentScaleFactor(2.0f);         //2倍のスケールサイズ
    }
    else if (m_device->isIPhone5()) // 4-inch
    {
        CCLOG("is iphone 5.");
        searchPaths.push_back("./images/iphonehd");  //Resources/Published-iOS/resources-iphonehd
        
        
        CCEGLView::sharedOpenGLView()->setDesignResolutionSize(FWD_IPHONE5_LANDSCAPE_WIDTH,
                                                               FWD_IPHONE_LANDSCAPE_HEIGHT,
                                                               kResolutionNoBorder);
        pDirector->setContentScaleFactor(2.f);         //2倍のスケールサイズ
    }
    else if (m_device->isIPhone())
    {
        CCLOG("is iphone3GS.");
        searchPaths.push_back("./images/iphone");  //Resources/Published-iOS/resources-iphone
        
        CCEGLView::sharedOpenGLView()->setDesignResolutionSize(FWD_IPHONE_LANDSCAPE_WIDTH,
                                                               FWD_IPHONE_LANDSCAPE_HEIGHT,
                                                               kResolutionNoBorder);
        pDirector->setContentScaleFactor(1.0f);
    }

#else        // Other plateform. (Android...)

    searchPaths.push_back("./images"); // Resources/Published-iOS
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(FWD_IPHONE_LANDSCAPE_WIDTH,
                                                           FWD_IPHONE_LANDSCAPE_HEIGHT,
                                                           kResolutionExactFit);

#endif
    // About search path, please check: http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Mechanism_of_loading_resources
    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
}
开发者ID:wakin001,项目名称:Framework_cocos2dx,代码行数:57,代码来源:FWGame.cpp

示例9: 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

示例10: applicationDidFinishLaunching

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

    CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
    
    CCSize designSize = CCSizeMake(480, 320);
    
    if (screenSize.height > 320)
    {
        CCSize resourceSize = CCSizeMake(960, 640);
        CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
        pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
    }
    
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.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);

    CCScene * pScene = CCScene::create();
    CCLayer * pLayer = new TestController();
    pLayer->autorelease();

    pScene->addChild(pLayer);
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:darkcl,项目名称:Cocos2d-x_Photon_MultiPlatform_Test,代码行数:34,代码来源:AppDelegate.cpp

示例11: 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

示例12: applicationDidFinishLaunching

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

	CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
	//pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
	pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);

	//set ScaleFactor
	pDirector->setContentScaleFactor( 640 / designResolutionSize.width);

    // turn on display FPS
    pDirector->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);

    // register lua engine
    //CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
    //CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);

    //std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
    //pEngine->executeScriptFile(path.c_str());

	View::_gamemanager::instance()->DisplayNowScene(View::SCENE_INIT);


    return true;
}
开发者ID:pope88,项目名称:CocInside,代码行数:31,代码来源:AppDelegate.cpp

示例13: applicationDidFinishLaunching

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

    pDirector->setOpenGLView(pEGLView);
	
	    //FIXED_WIDTH
	pEGLView->setDesignResolutionSize(320, 480 , ResolutionPolicy::kResolutionShowAll);
    std::vector<std::string> searchPath;
    searchPath.push_back("image");
    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);
    pDirector->setContentScaleFactor(640 / 320);

    // turn on display FPS
    pDirector->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);

    // create a scene. it's an autorelease object
	auto pScene = PlayLayer::CreatScene();

    // run
    pDirector->runWithScene(pScene);

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

示例14: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    pDirector->setProjection(kCCDirectorProjection2D);


    CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();

    CCSize designSize = CCSizeMake(320, 480);
    CCSize resourceSize = CCSizeMake(320, 480);
    
    if (screenSize.height > 1024)
    {
        resourceSize = CCSizeMake(1536, 2048);
        CCFileUtils::sharedFileUtils()->setResourceDirectory("resources-ipadhd");
    }
     else if (screenSize.height > 960)
    {
        resourceSize = CCSizeMake(768, 1536);
        CCFileUtils::sharedFileUtils()->setResourceDirectory("resources-ipad");
    }
    else if (screenSize.height > 480)
    {
        resourceSize = CCSizeMake(640, 960);
        CCFileUtils::sharedFileUtils()->setResourceDirectory("resources-iphonehd");
        
    }
    else
    {
        CCFileUtils::sharedFileUtils()->setResourceDirectory("resources-iphone");
    }
    
    pDirector->setContentScaleFactor(resourceSize.height/designSize.height);

    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.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);
    
    ScriptingCore* sc = ScriptingCore::getInstance();
    sc->addRegisterCallback(register_all_cocos2dx);
    sc->addRegisterCallback(register_cocos2dx_js_extensions);
    sc->addRegisterCallback(register_CCBuilderReader);
    sc->addRegisterCallback(jsb_register_chipmunk);
    sc->addRegisterCallback(jsb_register_system);
    
    sc->start();

    js_log("RUNNING Main");
    CCScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
    CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
    ScriptingCore::getInstance()->runScript("main.js");
       
    return true;
}
开发者ID:BradB132,项目名称:cocos2d-x,代码行数:60,代码来源:AppDelegate.cpp

示例15: applicationDidFinishLaunching

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

    pDirector->setOpenGLView(pEGLView);
	
    //Fit screen of any size
    pEGLView->setDesignResolutionSize(320, 480, kResolutionExactFit);
    pDirector->setContentScaleFactor(1);
    
    
    // turn on display FPS
    pDirector->setDisplayStats(false);

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);

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

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:FreeDao,项目名称:FaceBook-Working--FlappyBird,代码行数:26,代码来源:AppDelegate.cpp


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