예제 #1
0
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.
    TargetPlatform target = getTargetPlatform();//获取当前设备类型
    
    if (target == kTargetIpad){//如果是Ipad
        if (pDirector->enableRetinaDisplay(true)){ //如果开启高清视网膜
            
        }else {
        }
    }
    else if (target == kTargetIphone) {//如果是iphone
        if (pDirector->enableRetinaDisplay(true))
        {
        }
        else
        {
        }
    }
    else if (target == kTargetAndroid)//如果是android
    {
    }
    else if (target == kTargetWindows)//如果是Windows
    {
    }
    else if (target == kTargetMacOS)//如果是MacOS
    {
    }
    

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

    // set FPS. the default value is 1.0/60 if you don't call thisdf
    pDirector->setAnimationInterval(1.0 / 60);
   
    // game init
    CCScheduler * scheduler = CCDirector::sharedDirector()->getScheduler();
    scheduler->scheduleSelector(schedule_selector(AppDelegate::AppUpdate), this, 1.0f/60, false);
    
    if( GameControl::RunGameControl() )
	{
		NetMessageManager::GetMessageManager();
	}

	if(  SceneManage::GetSceneManageHendle() )
	{
        SceneManage::GetSceneManageHendle()->RunScece( SCENE_LOGIN, false );
	}
   
    return true;
}
예제 #2
0
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;
}
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);
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(480, 320,kResolutionShowAll);

    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))
        {
            // iphone hd
            CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
        }
    }


    // turn off 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 = MainMenu::scene();

    // run
    pDirector->runWithScene(pScene);
    return true;
}
예제 #4
0
bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());

    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))
        {
            // iphone hd
            CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
        }
    }

    //script config
    CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
    CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
    LuaHelper::s_executeFile( "resources_define.lua");
    LuaHelper::s_executeFile( "ui_texts_chs.lua");

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

    SceneManager::startLogoScene();

    return true;
}
예제 #5
0
bool AppDelegate::applicationDidFinishLaunching()
{
    AppSettings::sharedAppSettings()->initWithPlistFile("config.plist");
    
    char buffer[50];
    for(int i = 1; i <= 4; i++)
    {
        sprintf(buffer, "brickbig%d.wav", i);
        std::string absPath = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(buffer);
        CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect(absPath.c_str());
    }
    
    // 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
    float fRate = 1.0f / AppSettings::sharedAppSettings()->getFloat("defaultSpriteFrameRate");
    pDirector->setAnimationInterval(fRate);

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

    // run
    pDirector->runWithScene(pScene);

    return true;
}
예제 #6
0
파일: AppDelegate.cpp 프로젝트: nodephp/fly
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);

//    test_1
//    CCScene *pScene = game_bj::scene();
//    pDirector->runWithScene(pScene);

//    test_2
//    layer_main *layer_main = new layer_main();
//    CCScene *pScene = layer_main->scene();
//    pDirector->replaceScene(pScene);

    CCScene *pScene = cj_1::scene();
    pDirector->runWithScene(pScene);

    return true;
}
예제 #7
0
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);

	// sets landscape mode
	// pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);

	// turn on display FPS
	pDirector->setDisplayFPS(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 = MainScene::scene();

	// run
	pDirector->runWithScene(pScene);

	return true;
}
예제 #8
0
//初始化引擎
void Ag2dEngine::start()
{
	CCDirector* director = CCDirector::sharedDirector();
	//初始化场景导演
	director->setOpenGLView(&CCEGLView::sharedOpenGLView());
	director->enableRetinaDisplay(CONF_ENABLE_RETINA);
	director->setDisplayFPS(CONF_SHOW_FPS);
	director->setAnimationInterval(CONF_FPS_VAL);	
	
	//启动
	playScene( reg_scene );
}
예제 #9
0
bool AppDelegate::applicationDidFinishLaunching()
{
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(&CCEGLView::sharedOpenGLView());

	pDirector->enableRetinaDisplay(false);

    pDirector->setDeviceOrientation(kCCDeviceOrientationLandscapeLeft);
    pDirector->setDisplayFPS(false);
	pDirector->setAnimationInterval(1.0 / 60);
	pDirector->setDepthTest(false);

	CCScene *pScene = GameScene::node();
	CCDirector::sharedDirector()->runWithScene(pScene);

    return true;
}
예제 #10
0
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);
    
    CCTexture2D::PVRImagesHavePremultipliedAlpha(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 / 30);
    
    // register lua engine  --- by GW
    CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
    CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);

    // create a scene. it's an autorelease object
    //CCScene *pScene = HelloWorld::scene();
    CCScene *pScene = GamePlayScene::scene();
    //CCScene *pScene = TestScene::scene();
    
    // run
    pDirector->runWithScene(pScene);
    
    /*
     #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
     CCString* pstrFileContent = CCString::createWithContentsOfFile("hello.lua");
     if (pstrFileContent)
     {
     pEngine->executeString(pstrFileContent->getCString());
     }
     #else
     std::string path = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath("hello.lua");
     pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
     pEngine->executeScriptFile(path.c_str());
     #endif
     */

    return true;
}
예제 #11
0
bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    pDirector->enableRetinaDisplay(true);
    
    //TargetPlatform target = getTargetPlatform();
    
//    if (target == kTargetIpad)
//    {
//        // ipad
//        
//        // try to enable retina on device
//        if (true == pDirector->enableRetinaDisplay(true))
//        {
//            // iphone hd
//            CCFileUtils::sharedFileUtils()->setResourceDirectory("spriteshd");
//            CCFileUtils::sharedFileUtils()->setResourceDirectory("backgroundhd");
//        }
//        else
//        {
//            CCFileUtils::sharedFileUtils()->setResourceDirectory("sprites");
//            CCFileUtils::sharedFileUtils()->setResourceDirectory("background");
//        }
//    }
//    else if (target == kTargetIphone)
//    {
//        // iphone
//        
//        // try to enable retina on device
//        if (true == pDirector->enableRetinaDisplay(true))
//        {
//            // iphone hd
//            CCFileUtils::sharedFileUtils()->setResourceDirectory("spriteshd");
//            CCFileUtils::sharedFileUtils()->setResourceDirectory("backgroundhd");
//        }
//        else
//        {
//            CCFileUtils::sharedFileUtils()->setResourceDirectory("sprites");
//            CCFileUtils::sharedFileUtils()->setResourceDirectory("background");
//            
//        }
//    }
//    else
//    {
//        // android, windows, blackberry, linux or mac
//        // use 960*640 resources as design resolution size
//        CCFileUtils::sharedFileUtils()->setResourceDirectory("spriteshd");
//        CCFileUtils::sharedFileUtils()->setResourceDirectory("backgroundhd");
//        //CCEGLView::sharedOpenGLView()->setDesignResolutionSize(800, 480, kResolutionNoBorder);
//    }
    //CCFileUtils::sharedFileUtils()->setResourceDirectory("spriteshd");
    //CCFileUtils::sharedFileUtils()->setResourceDirectory("backgroundhd");

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

    // run
    pDirector->runWithScene(pScene);

    return true;
}