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


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

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


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

示例1: applicationDidFinishLaunching

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

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

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

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

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:joyfish,项目名称:code,代码行数:20,代码来源:AppDelegate.cpp

示例2: applicationDidFinishLaunching

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

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

#ifdef TIZEN
    CCSize designSize = CCSizeMake(1280, 720);
#else
    CCSize designSize = CCSizeMake(480, 320);
#endif
    CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();
    
    if (screenSize.height > 320)
    {
        CCSize resourceSize = CCSizeMake(960, 640);
        std::vector<std::string> searchPaths;
        searchPaths.push_back("hd");
        pFileUtils->setSearchPaths(searchPaths);
        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:Guillermomp87,项目名称:cocos2d-x,代码行数:41,代码来源:AppDelegate.cpp

示例3: applicationDidFinishLaunching

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

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

	pEGLView->setDesignResolutionSize(1136, 640, kResolutionNoBorder);
	//pEGLView->setFrameSize(960, 640)

    // 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 = GameWorld::scene();
	//CCScene* pScene = WarScene::scene();

    // run
    pDirector->runWithScene(pScene);

//	// 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
//
//	std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("hello.lua");
//	pEngine->executeScriptFile(path.c_str());

    return true;
}
开发者ID:flashsong,项目名称:firstTest,代码行数:41,代码来源:AppDelegate.cpp

示例4: applicationDidFinishLaunching

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

    pDirector->setOpenGLView(pEGLView);

    CCSize screenSize = pDirector->getWinSize();

    //set design screen size to the iPad and ExactFit (image is stretched to fill screen
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(768, 1024, kResolutionShowAll);
    //if device's screen width is greater than 768, use high definition images
    if (screenSize.width > 768) {
        cocos2d::CCFileUtils::sharedFileUtils()->addSearchPath("hd");
//        CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
        pDirector->setContentScaleFactor(2);
        //or else, use standard definition
    } else {
        cocos2d::CCFileUtils::sharedFileUtils()->addSearchPath("sd");
//        CCFileUtils::sharedFileUtils()->setResourceDirectory("sd");
        pDirector->setContentScaleFactor(1);
    }
    
    //preload sound effects
    SimpleAudioEngine::sharedEngine()->preloadEffect( (CCFileUtils::sharedFileUtils()->fullPathForFilename("hit.wav")).c_str() );
    SimpleAudioEngine::sharedEngine()->preloadEffect( (CCFileUtils::sharedFileUtils()->fullPathForFilename("score.wav")).c_str() );
    // 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 = CCLobbyView::scene();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:kaznog,项目名称:t09,代码行数:41,代码来源:AppDelegate.cpp

示例5: applicationDidFinishLaunching

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

	CCSize designSize = CCSizeMake(800, 480);
	CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();

	if (screenSize.height > 320)
	{
		//CCSize resourceSize = CCSizeMake(960, 640);
		//pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
	}
	pEGLView->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);

    // register lua engine
    CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
    CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
	luaopen_cocos2dx_extensions_luabinding(pEngine->getLuaStack()->getLuaState());
	luaopen_cocos2dx_network_luabinding(pEngine->getLuaStack()->getLuaState());
	luaopen_cocos2dx_cliplayer_luabinding(pEngine->getLuaStack()->getLuaState());
	luaopen_cocos2dx_stylelabel_luabinding(pEngine->getLuaStack()->getLuaState());
	luaopen_cocos2dx_BYGraySprite_luabinding(pEngine->getLuaStack()->getLuaState());
	#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
			LuaJavaBridge::luabindingOpen(pEngine->getLuaStack()->getLuaState());
	#endif
    std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("luascript/Global.lua");
    pEngine->executeScriptFile(path.c_str());

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

示例6: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{

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

    // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
    // pDirector->enableRetinaDisplay(true);

    // 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
    pScene = MainMenu::create();
    CCLayer* pLayer1 = new MainMenuLayer();
    CCLayer* pLayer2 = new OptionsLayer();
    CCLayer* pLayer3 = new AudiogramSceneLayer();
    CCLayer* pLayer4 = new CreditsLayer();
    CCLayer* pLayer5 = new LevelLayer();
    CCLayer* pLayer6 = new CalibrateLayer();


    CCLayerMultiplex* layer = CCLayerMultiplex::create(pLayer1, pLayer2, pLayer3, pLayer4, pLayer5, pLayer6, NULL);
    pScene->addChild(layer, 0);

    pLayer1->release();
    pLayer2->release();
    pLayer3->release();
    pLayer4->release();
    pLayer5->release();
    pLayer6->release();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:ben-yu,项目名称:Sones,代码行数:41,代码来源:AppDelegate.cpp

示例7: applicationDidFinishLaunching

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

    // turn on display FPS
    pDirector->setDisplayStats(ShowFrame);
    pDirector->setAnimationInterval(1.0 / 60);

	CCSize frameSize = eglView->getFrameSize();
	eglView->setDesignResolutionSize(frameSize.width, frameSize.height, kResolutionNoBorder);

    // create a scene. it's an autorelease object
	//Ö÷²Ëµ¥
	CCScene* pScene = MainScene::create();
	//CCScene* pScene = GameScene::create();
	//CCScene* pScene = CMainMenu::StartMenu();
	pDirector->runWithScene(pScene);
    return true;
}
开发者ID:bo-jwolf,项目名称:Graduation,代码行数:21,代码来源:AppDelegate.cpp

示例8: applicationDidFinishLaunching

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

	CCEGLView::sharedOpenGLView()->setDesignResolutionSize(1024, 512, kResolutionShowAll);

	SimpleAudioEngine::sharedEngine()->playBackgroundMusic("music/05 the first million.mp3");

	pDirector->setDisplayStats(true);

	pDirector->setAnimationInterval(1.0 / 60);

	pDirector->runWithScene(DemoScene::scene());
	//SimpleAudioEngine::sharedEngine()->vibrate(1000);

	//pDirector->runWithScene(SpaceAdventureScene::scene());
	pDirector->runWithScene(BootScene::scene());
	/* 调用场景管理器切换场景 */
    //SceneManager::sharedSceneManager()->changeScene(SceneManager::en_DemoScene);
    return true;
}
开发者ID:guinao,项目名称:CallofDefense,代码行数:21,代码来源:AppDelegate.cpp

示例9: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
    pDirector->setOpenGLView(pEGLView);
    pEGLView->setDesignResolutionSize(768, 1024, kResolutionShowAll);
	
    // turn on display FPS
    pDirector->setDisplayStats(false);

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

    // create a scene. it's an autorelease object
    CCScene *pScene = GameLayer::scene();
    pDirector->runWithScene(pScene);

    printf("applicationDidFinishLaunching\n");

    return true;
}
开发者ID:ywl19891989,项目名称:ReversiGame,代码行数:21,代码来源:AppDelegate.cpp

示例10: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    
    // turn on display FPS
    pDirector->setDisplayStats(true);

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

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

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

    return true;
}
开发者ID:kk2001,项目名称:LuaDemoTest,代码行数:21,代码来源:AppDelegate.cpp

示例11: applicationDidFinishLaunching

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

    pDirector->setOpenGLView(pEGLView);
	pEGLView->setDesignResolutionSize(320, 480, kResolutionExactFit);
    // turn on display FPS
    pDirector->setDisplayStats(true);

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

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

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:VishalKreart,项目名称:MyGame,代码行数:21,代码来源:AppDelegate.cpp

示例12: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    //pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    
    CCSize screenSize = pDirector->getWinSize();
    CCLOG("%f %f", screenSize.width, screenSize.height);
    //CCSize screenSize = pEGLView->getFrameSize();
    //CCEGLView::sharedOpenGLView() -> setDesignResolutionSize(768, 1024, kResolutionExactFit);
    if (screenSize.width > 768) {
        CCLOG("hd");
        CCFileUtils::sharedFileUtils()->addSearchPath("hd");
        pDirector->setContentScaleFactor(2);
    } else {
        CCLOG("SD");
        //or else, use standard definition
        CCFileUtils::sharedFileUtils()->addSearchPath("sd");
        pDirector->setContentScaleFactor(1);
    }

    SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("hit.wav").c_str());
    SimpleAudioEngine::sharedEngine()->preloadEffect(CCFileUtils::sharedFileUtils()->fullPathForFilename("score.wav").c_str());
AVAudioSession
    // 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:ctchan3,项目名称:Air-Hockey,代码行数:40,代码来源:AppDelegate.cpp

示例13: applicationDidFinishLaunching

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

	    CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
	    CCSize designSize = CCSizeMake(480,320);
	    std::vector<std::string> searchPaths;


	    if(screenSize.height>320) {
	    	searchPaths.push_back("HD");
	    	searchPaths.push_back("SD");
	    	pDirector->setContentScaleFactor(640.0f/designSize.height);
	    }
	    else {
	    	searchPaths.push_back("SD");
	    	pDirector->setContentScaleFactor(320.0f/designSize.height);
	    }

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

	    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder);


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

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

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

	    // run
	    pDirector->runWithScene(pScene);

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

示例14: applicationDidFinishLaunching

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

    pDirector->setOpenGLView(pEGLView);

    
    CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();    
    
    CCSize designSize = CCSizeMake(480, 320);
    
    CCFileUtils* pFileUtils = CCFileUtils::sharedFileUtils();
    
    if (screenSize.height > 320)
    {
        CCSize resourceSize = CCSizeMake(960, 640);
        std::vector<std::string> searchPaths;
        searchPaths.push_back("hd");
        pFileUtils->setSearchPaths(searchPaths);
        pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
    }
    
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionShowAll);
     
	
    // turn on display FPS
//    pDirector->setDisplayStats(true);

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

    // create a scene. it's an autorelease object
    CocosGUITestScene* pScene = new CocosGUITestScene();

    // run
    pDirector->runWithScene(pScene);

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

示例15: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    
//    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(480, 320, kResolutionShowAll);
	const float screenWidth = 800;
    const CCSize& frameSize = CCEGLView::sharedOpenGLView()->getFrameSize();
	CCEGLView::sharedOpenGLView()->setDesignResolutionSize(screenWidth, screenWidth * frameSize.height / frameSize.width, kResolutionShowAll);

    // enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
    // pDirector->enableRetinaDisplay(true);

    // 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::vector<std::string>::const_iterator iter;
    for (iter = m_aLuaCmd.begin(); iter != m_aLuaCmd.end(); iter++)
		pEngine->executeString(iter->c_str());

    if (m_aLuaScript.size() > 0)
    {
        for (iter = m_aLuaScript.begin(); iter != m_aLuaScript.end(); iter++)
            execScript(pEngine, *iter);
    }
    else
    {
        execScript(pEngine, "main.lua");
    }

    return true;
}
开发者ID:pontelua,项目名称:Lua2D-SDK,代码行数:40,代码来源:AppDelegate.cpp


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