Example #1
0
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);

    CC_ASSERT(GameScene::sharedGameScene());

    // run
    pDirector->runWithScene(GameScene::sharedGameScene());

    return true;
}
bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
	ResetGGMager::getInstance();

    pDirector->setOpenGLView(pEGLView);

	pEGLView->setDesignResolutionSize(1920, 1080, kResolutionShowAll);
    // turn on display FPS
	pDirector->setDisplayStats(Ext_TiaoShi);

    // 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 = LodingScene::getLodingScene();
    // run
    pDirector->runWithScene(pScene);
    return true;
}
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;
}
Example #4
0
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;
}
Example #5
0
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;
}
Example #6
0
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;
}
Example #7
0
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;
}
Example #8
0
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;
}
Example #9
0
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;
}
Example #10
0
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;
}
Example #11
0
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;
}
Example #12
0
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;
}
Example #13
0
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;
}
Example #14
0
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;
}
Example #15
0
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);
    std::vector<std::string> searchPaths;

    if (screenSize.height > 320)
    {
//        searchPaths.push_back("hd");
        searchPaths.push_back("sd");
//        pDirector->setContentScaleFactor(screenSize.height/designSize.height);
    }
    else
    {
        searchPaths.push_back("sd");
        pDirector->setContentScaleFactor(320.0f/designSize.height);
    }
	CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);

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

    // run
    pDirector->runWithScene(pScene);

    return true;
}
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);

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

    // run
    pDirector->runWithScene(pScene);

    int appID = YOUR_APP_ID;
    const char *secrect = "YOUR_APP_SECRET";
    GPEnvironment environment = GPEnvironmentDevelopment;
    bool debug = true;
    EGPOption option = EGPOptionAll;
    const char *senderID = "YOUR_SENDER_ID";
    
    GrowthPush::initialize(appID, secrect, environment, debug, option);
    GrowthPush::registerDeviceToken(senderID);
    GrowthPush::setDeviceTags();
    GrowthPush::trackEvent("Event");
    GrowthPush::trackEvent("Event", "Value");
    GrowthPush::setTag("Tag");
    GrowthPush::setTag("Tag", "Value");
    GrowthPush::clearBadge();
    
    GrowthPush::launchWithNotification(this, gp_remote_notification_selector(AppDelegate::didReceiveRemoteNotification));
    
    return true;
}
Example #17
0
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);

    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->addRegisterCallback(registerDeviceSpeceficTests);
    sc->start();

    CCScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
    CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
#ifdef JS_OBFUSCATED
    ScriptingCore::getInstance()->runScript("game.js");
#else
#if JSB_ENABLE_DEBUGGER
    ScriptingCore::getInstance()->enableDebugger();
#endif // JSB_ENABLE_DEBUGGER
    ScriptingCore::getInstance()->runScript("tests-boot-jsb.js");
#endif

    return true;
}
Example #18
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);

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

    // run
    pDirector->runWithScene(pScene);
    return true;
}
Example #19
0
bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* director = CCDirector::sharedDirector();
    director->setOpenGLView(CCEGLView::sharedOpenGLView());
    
    // 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
    CCScene * scene = CCScene::create();

    GameScreen * gameScreen = GameScreen::create();
    scene->addChild(gameScreen);

    // run
    director->runWithScene(scene);

    return true;
}
Example #20
0
bool AppDelegate::applicationDidFinishLaunching()
{
	/*CCUserDefault* myUserDefault=CCUserDefault::sharedUserDefault();
	if (myUserDefault->getBoolForKey(KEY_IS_FIRST_RUN,true))
	{
		myUserDefault->setBoolForKey(KEY_IS_FIRST_RUN,false);

		CCLOG("first");

	}else
	{
		CCLOG("not first");
	}*/




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


	CCSize designSize=CCSizeMake(800,480);
	CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width,designSize.height,kResolutionExactFit);

    // 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(StartLayer::scene());
	//pDirector->runWithScene(SurpriseLayer::scene());
    return true;
}
Example #21
0
bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

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

    // Set the design resolution
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
    pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionShowAll);
#else
    pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);
#endif

    
      //ÉèÖÃcontentScaleFactor
    pDirector->setContentScaleFactor(1);//µ±×ÊÔ´³ß´çÓëdesign³ß´ç²»Í¬Ê±ÐèҪʹÓÃËüÀ´½øÐÐËõ·Å

   
    // set searching path
	vector<string> searchPath;
    searchPath.push_back(resourceSearchDic);
    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);

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

    // run
    pDirector->runWithScene(pScene);

    return true;
}
Example #22
0
bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

    pDirector->setOpenGLView(pEGLView);
	CCSize frameSize = pEGLView->getFrameSize();
	gDesignSize.width = 480;
	gDesignSize.height = 320;

	float fResouceWH = gDesignSize.width / gDesignSize.height;
	float fViewWH = frameSize.width / frameSize.height;
	if (fViewWH >= fResouceWH)
	{
		pEGLView->setDesignResolutionSize(gDesignSize.width, gDesignSize.height, kResolutionFixedHeight);
		gSolutionType = kResolutionFixedHeight;
	} 
	else
	{
		pEGLView->setDesignResolutionSize(gDesignSize.width, gDesignSize.height, kResolutionFixedWidth);
		gSolutionType = kResolutionFixedWidth;
	}
	gViewSize = pEGLView->getVisibleSize();
    // 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 = GameLayer::scene();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
Example #23
0
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);

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

    // run
    //pDirector->runWithScene(pScene);

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

	//connect 
	//TcpNetWork::_TcpNet.connect("127.0.0.1", 7770, 50);

	sSCfg.load();

	Worker::_tcp.initTcpInfo(sSCfg.tcpHost.c_str(), sSCfg.tcpPort);
	Worker::_tcp.start();
	
	System::Sleep(5000);
	Packet::UserLogin ul;
	ul.SetUsername("test1@pope");
	ul.send();

	cout<<"client send"<<std::endl;

    return true;
}
Example #24
0
bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());

    pDirector->setDisplayStats(true);
    pDirector->setAnimationInterval(1.0 / 60);
	CCEGLView::sharedOpenGLView()->setDesignResolutionSize(960, 640, kResolutionShowAll);

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

	CCFileUtils::sharedFileUtils()->addSearchPath("luaScript");

	//cocoswidget lua binding open api
	tolua_Lua_cocos2dx_widget_open(tolua_s);

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

    return true;
}
Example #25
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);

    // 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);
    /**/
    
    /**
    // もしCocosBuildrにしたら
    CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
    CCBReader * ccbReader = new CCBReader(ccNodeLoaderLibrary);
    CCScene * scene = CCScene::create();
    CCNode * node = ccbReader->readNodeGraphFromFile("CCBTest.ccbi");
    
    if(node != NULL) {
        scene->addChild(node);
    }
    ccbReader->release();
    pDirector->runWithScene(scene);
    /**/
    
    return true;
}
Example #26
0
bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(g_nScreenWidth, g_nScreenHeight, 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);
	

    // register lua engine
    CCLuaEngine* pEngine = CCLuaEngine::defaultEngine();
    CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
	
	lua_State * pLuaState = ScutDataLogic::LuaHost::Instance()->GetLuaState();

	//CDataRequest::Instance()->RegisterLUACallBack((LUA_DATAHANDLE_CALLBACK)&ScutCxControl::netDataDispatch);
	//CFrameManager::Instance(); 
	char tempPath[MAX_PATH + 1];
	::GetModuleFileNameA(NULL,tempPath, _MAX_PATH + 1);
	string ret((char*)tempPath);
	ret = ret.substr(0,ret.rfind("\\") +  1);

    //std::string path = CCFileUtils::sharedFileUtils()->fullPathForFilename("E:/ND/openSourceEngine/Scutgame/Release.win32/lua/mainapp.lua");
	std::string path =ret +  "lua/mainapp.lua";
	//CFileHelper::executeScriptFile(NdDataLogic::CFileHelper::getPath("lua/mainapp.lua").c_str());
     pEngine->executeScriptFile(path.c_str());

	 CCSize szWin = pDirector->getWinSize();
	 CFileHelper::setWinSize(szWin.width, szWin.height);

    return true;
}
bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    
    CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
    CCSize designSize = CCSizeMake(480.0f, 320.0f);
    std::vector<std::string> searchPaths;
    
    if (screenSize.height >= 320)
    {
		searchPaths.push_back("iphone");
		searchPaths.push_back("music");
		searchPaths.push_back("iphone/tiledmap");
        //pDirector->setContentScaleFactor(screenSize.height/designSize.height);
    }
    
    
    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
    
    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);

    // create a scene. it's an autorelease object
    MainMenuScene *pScene = new MainMenuScene();
    pScene->init();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
Example #28
0
bool AppDelegate::applicationDidFinishLaunching()
{
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    CCEGLView *pEGLView = CCEGLView::sharedOpenGLView();
    pDirector->setOpenGLView(pEGLView);
    
    //设置view size
    CCSize screenSize = pEGLView->getFrameSize();
    CCSize designSize = CCSize(320, 480);
    
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionShowAll);
    
    //设置资源路径
    std::vector<std::string> searchPaths;
    if (screenSize.width > 320 ) {  //临时把高清直接从小图放大
        searchPaths.push_back("iphone");    //iphonehd 临时
        pDirector->setContentScaleFactor(1);    //320/designSize.width 临时
    }else {
        searchPaths.push_back("iphone");
        pDirector->setContentScaleFactor(320/designSize.width);
    }
    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);

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

    // run
    pDirector->runWithScene(pScene);

    return true;
}
Example #29
0
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 / FPS);

    // create a scene. it's an autorelease object
    CCScene *pScene = CCScene::create();
    CCLayer *pSplashLayer = new Splash();
    pSplashLayer->autorelease();
    
    pScene->addChild(pSplashLayer);
    pDirector->runWithScene(pScene);

    return true;
}
Example #30
0
bool AppDelegate::applicationDidFinishLaunching()
{
	MyPurchase::sharedPurchase()->loadIAPPlugin();

    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
    pEGLView->setDesignResolutionSize(960.0f, 640.0f, 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 = HelloWorld::scene();

    // run
    pDirector->runWithScene(pScene);

    return true;
}