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


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

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


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

示例1: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    Director* director = Director::getInstance();
    EGLView* glView = EGLView::getInstance();

    director->setOpenGLView(glView);
    
    Size size = director->getWinSize();

	setDesignResolution();

    // Set the design resolution
	glView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
	
    // 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
#if(CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
	Scene *scene = MainTitleScene::create();
#else
    Scene *scene = HelloWorld::scene();
#endif
    // run
    director->runWithScene(scene);

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

示例2: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    Director* director = Director::getInstance();
    EGLView* eglView = EGLView::getInstance();

    // チラツキ対策
//    Director::getInstance()->setProjection(Director::Projection::_2D);
    Director::getInstance()->setDepthTest(false);
  
    Director::getInstance()->setOpenGLView(eglView);
	
    // 800x480基準
    eglView->setDesignResolutionSize(800.0 * 0.6,
                                     480.0 * 0.6,
                                     ResolutionPolicy::SHOW_ALL);
    
    // 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
//    Scene *pScene = GameScene::scene();
    auto *pScene = TitleSceneLoader::createScene();

    // run
    director->runWithScene(pScene);

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

示例3: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
	Director* director = Director::getInstance();
	GLView* 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);

    register_all_packages();

    // create a scene. it's an autorelease object
    Scene* scene = WelcomeScene::scene();

    // run
    director->runWithScene(scene);

    SimpleAudioEngine::getInstance()->preloadBackgroundMusic("sounds/BgmCity.mp3");
    SimpleAudioEngine::getInstance()->playBackgroundMusic("sounds/BgmCity.mp3",true);
    return true;
}
开发者ID:dyn654466499,项目名称:MyCocosGame,代码行数:27,代码来源:AppDelegate.cpp

示例4: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
	// initialize director
	Director* director = Director::getInstance();
	EGLView* eglView = EGLView::getInstance();

	director->setOpenGLView(eglView);

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

	Size screenSize = Director::getInstance()->getWinSize();
	screenHeight = screenSize.height;
	screenWidth = screenSize.width;
	factorX = screenWidth / designWidth;
	factorY = screenHeight / designHeight;
	scaledWidth = screenWidth*factorX;
	scaledHeight = screenHeight*factorY;

	// create a scene. it's an autorelease object
	Scene *scene = MainMenuLayer::scene();
	// run
	director->runWithScene(scene);
	return true;
}
开发者ID:smrutled,项目名称:Tilter2dx,代码行数:27,代码来源:AppDelegate.cpp

示例5: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    Director *director = Director::getInstance();
    director->setOpenGLView(EGLView::getInstance());
    
    // 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);
    
    ScriptingCore* sc = ScriptingCore::getInstance();
    sc->addRegisterCallback(register_all_cocos2dx);
    sc->addRegisterCallback(register_all_cocos2dx_extension);
    sc->addRegisterCallback(register_cocos2dx_js_extensions);
    sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
    sc->addRegisterCallback(jsb_register_chipmunk);
    sc->addRegisterCallback(JSB_register_opengl);
    sc->addRegisterCallback(jsb_register_system);
    sc->start();
    
    ScriptEngineProtocol *engine = ScriptingCore::getInstance();
    ScriptEngineManager::getInstance()->setScriptEngine(engine);
    ScriptingCore::getInstance()->runScript("cocos2d-jsb.js");
       
    return true;
}
开发者ID:FlavioFalcao,项目名称:NautiPlot,代码行数:28,代码来源:AppDelegate.cpp

示例6: applicationDidFinishLaunching

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

    pDirector->setOpenGLView(pEGLView);

    // Set the design resolution
    pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);

	Size 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
    FileUtils::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);

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

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:58,代码来源:AppDelegate.cpp

示例7: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    Director *pDirector = Director::sharedDirector();

    pDirector->setOpenGLView(EGLView::sharedOpenGLView());

    Size screenSize = EGLView::sharedOpenGLView()->getFrameSize();
    //Size designSize = CCSizeMake(1600, 900);
    Size designSize = CCSizeMake(12*101, 12*81);
    std::vector<std::string> searchPaths;

    if (screenSize.height > 320)
    {
        searchPaths.push_back("hd");
        searchPaths.push_back("sd");
        Size resourceSize = CCSizeMake(12*101, 12*81);
        //pDirector->setContentScaleFactor(960.0f/designSize.height);
        ///pDirector->setContentScaleFactor(1.0f);
        pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
    }
    else
    {
        searchPaths.push_back("sd");
        pDirector->setContentScaleFactor(640.0f/designSize.height);
    }

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

    EGLView::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);

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

    if (_levelToLaunch == nullptr)
    {
        scene = MainMenuLayer::scene();
    }
    else
    {
        auto ms = Bomber::Frontend::MenuSelections::getInstance();
        ms->setLevelFilename(_levelToLaunch);
        ms->setLevelName("test");
        scene = GameplayScene::scene();
    }

    // run
    pDirector->runWithScene(scene);

    return true;
}
开发者ID:reneklacan,项目名称:bomber,代码行数:57,代码来源:AppDelegate.cpp

示例8: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    Director *director = Director::getInstance();
    director->setOpenGLView(EGLView::getInstance());
    
    // 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);
    
    ScriptingCore* sc = ScriptingCore::getInstance();
    sc->addRegisterCallback(register_all_cocos2dx);
    sc->addRegisterCallback(register_all_cocos2dx_extension);
    sc->addRegisterCallback(register_cocos2dx_js_extensions);
    sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
    sc->addRegisterCallback(jsb_register_chipmunk);
    sc->addRegisterCallback(JSB_register_opengl);
    sc->addRegisterCallback(jsb_register_system);
    sc->addRegisterCallback(register_mask_all);
    sc->start();
    
    ScriptEngineProtocol *engine = ScriptingCore::getInstance();
    ScriptEngineManager::getInstance()->setScriptEngine(engine);
    ScriptingCore::getInstance()->runScript("cocos2d-jsb.js");

    cocos2d::plugin::TAdsDeveloperInfo devInfo;
    devInfo["AdmobID"] = "a1530e0a2793b0f"; /*my id*/
    cocos2d::plugin::ProtocolAds* admob =  dynamic_cast<cocos2d::plugin::ProtocolAds*>(cocos2d::plugin::PluginManager::getInstance()->loadPlugin("AdsAdmob"));
    cocos2d::plugin::AdsListener* listener = new MyAdsListener();
    cocos2d::plugin::ProtocolAds::AdsPos posAdmob = cocos2d::plugin::ProtocolAds::kPosTopLeft;
    cocos2d::plugin::TAdsInfo adInfo;
    admob->configDeveloperInfo(devInfo);
    admob->setAdsListener(listener);
    admob->setDebugMode(false);
    adInfo["AdmobType"] = "1";
    adInfo["AdmobSizeEnum"] = "1";
    admob->showAds(adInfo, posAdmob);

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

示例9: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    Director* director = Director::getInstance();
    EGLView* eglView = EGLView::getInstance();

    director->setOpenGLView(eglView);
	
    // 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
    Scene *scene = MainScene::getMainScene();

    // run
    director->runWithScene(scene);

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

示例10: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    Director* pDirector = Director::sharedDirector();
    EGLView* pEGLView = EGLView::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);

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

    // run
    pDirector->runWithScene(pScene);

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

示例11: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director & GLView
    Director *director = Director::getInstance();
    director->setProjection(Director::Projection::_2D);

    // 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
//    Scene *scene = CCColorMatrixFunctionalTestScene::scene();
    Scene *scene = MainMenuScene::scene();

    // run
    director->runWithScene(scene);

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

示例12: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    Director *director = Director::getInstance();

    director->setOpenGLView(EGLView::getInstance());

    Size screenSize = EGLView::getInstance()->getFrameSize();
    Size designSize = Size(480, 320);
    std::vector<std::string> searchPaths;

    if (screenSize.height > 320)
    {
        searchPaths.push_back("hd");
        searchPaths.push_back("sd");
        director->setContentScaleFactor(640.0f/designSize.height);
    }
    else
    {
        searchPaths.push_back("sd");
        director->setContentScaleFactor(320.0f/designSize.height);
    }

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

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

    // 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
    Scene *scene = HelloWorld::scene();

    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:CBanDa,项目名称:cocos2d-x-3.0alpha0-pre,代码行数:40,代码来源:AppDelegate.cpp

示例13: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    Director *director = Director::getInstance();
    director->setOpenGLView(EGLView::getInstance());


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

    // register lua engine
    LuaEngine* engine = LuaEngine::getInstance();
    ScriptEngineManager::getInstance()->setScriptEngine(engine);
    
    std::string path = FileUtils::getInstance()->fullPathForFilename("Script/main.lua");
    engine->executeScriptFile(path.c_str());

    return true;
}
开发者ID:0dayZh,项目名称:LoveClear,代码行数:22,代码来源:AppDelegate.cpp

示例14: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    Director *pDirector = Director::sharedDirector();
    pDirector->setOpenGLView(EGLView::sharedOpenGLView());
    
    EGLView::sharedOpenGLView()->setDesignResolutionSize(480, 320, 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
    LuaEngine* pEngine = LuaEngine::defaultEngine();
    ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);

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

    return true;
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:23,代码来源:AppDelegate.cpp

示例15: applicationDidFinishLaunching

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

    // JS-Test in Html5 uses 800x450 as design resolution
    EGLView::sharedOpenGLView()->setDesignResolutionSize(800, 450, kResolutionFixedHeight);
    // 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_all_cocos2dx_extension);
    sc->addRegisterCallback(register_cocos2dx_js_extensions);
    sc->addRegisterCallback(register_all_cocos2dx_extension_manual);
    sc->addRegisterCallback(jsb_register_chipmunk);
    sc->addRegisterCallback(JSB_register_opengl);
    sc->addRegisterCallback(jsb_register_system);
    sc->addRegisterCallback(MinXmlHttpRequest::_js_register);
    sc->addRegisterCallback(register_jsb_websocket);

    sc->start();

    ScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
    ScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#ifdef JS_OBFUSCATED
    ScriptingCore::getInstance()->runScript("game.js");
#else
    ScriptingCore::getInstance()->runScript("tests-boot-jsb.js");
#endif
    return true;
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:36,代码来源:AppDelegate.cpp


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