Example #1
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;
}
Example #2
0
bool AppDelegate::applicationDidFinishLaunching()
{
  CCDirector* director = CCDirector::sharedDirector();
  CCEGLView* EGLView = CCEGLView::sharedOpenGLView();
  CCSize  screenSize = EGLView->getFrameSize();

  director->setOpenGLView(EGLView);
  director->setContentScaleFactor(designResolutionSize.height / screenSize.height);

  vector <string> searchPath;

  searchPath.push_back(resources800x600.directory);

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

  mSharedScreenManager = ScreenManager::create();

  Options::SCREEN_WIDTH = designResolutionSize.width;
  Options::SCREEN_HEIGHT = designResolutionSize.height;

  Options::SCREEN_CENTER_X = designResolutionSize.width / 2;
  Options::SCREEN_CENTER_Y = designResolutionSize.height / 2;

  Options::CAMERA_WIDTH = screenSize.width;
  Options::CAMERA_HEIGHT = screenSize.height;

  Options::CAMERA_CENTER_X = screenSize.width / 2;
  Options::CAMERA_CENTER_Y = screenSize.height / 2;

  director->setAlphaBlending(false);
  director->setDepthTest(false);

  director->setDisplayStats(true);

  director->setProjection(kCCDirectorProjection2D);

  director->setAnimationInterval(1.0f / 60.0f);

  director->runWithScene(Loader::create());

  return true;
}
bool AppDelegate::applicationDidFinishLaunching()
{
	// initialize director
	CCDirector *pDirector = CCDirector::sharedDirector();
    
    if (! pDirector->setDirectorType(kCCDirectorTypeDisplayLink)) {
        pDirector->setDirectorType(kCCDirectorTypeDefault);
    }

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

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

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

	// run
	pDirector->runWithScene(pScene);
     */
    
    pDirector->runWithScene(GameLayer::scene());

	return true;
}
KDvoid TestList::setScene ( KDint nIndex, EDirection eDirection )
{	
	CCDirector*  pDirector = CCDirector::sharedDirector ( );
	pDirector->setDepthTest ( KD_FALSE );
	
	s_nTestIndex = nIndex;

	CCLayer*  pLayer = KD_NULL;
	
	if ( nIndex == 41 || nIndex == 42 )
	{
		CCEGLView::sharedOpenGLView ( )->setDesignResolutionSize ( s_tDesignSize, kResolutionShowAll );
	}
	else
	{
		CCEGLView::sharedOpenGLView ( )->setDesignResolutionSize ( s_tDesignSize, s_eResolutionPolicy );
	}

	switch ( nIndex )
	{
		case -1 : pLayer = TestList					::create ( ); break;		
		case  0 : pLayer = TestActions				::create ( ); break;									
		case  1 : pLayer = TestTransitions			::create ( ); break;
		case  2	: pLayer = TestProgressActions		::create ( ); break;	
		case  3 : pLayer = TestEffects				::create ( ); break;	
		case  4	: pLayer = TestClickAndMove			::create ( ); break;	
		case  5 : pLayer = TestRotateWorld			::create ( ); break;
		case  6 : pLayer = TestParticle				::create ( ); break;
		case  7 : pLayer = TestEaseActions			::create ( ); break;	
		case  8 : pLayer = TestMotionStreak			::create ( ); break;
		case  9	: pLayer = TestDrawPrimitives		::create ( ); break;
		case 10 : pLayer = TestNode					::create ( ); break;
		case 11 : pLayer = TestTouches				::create ( ); break;
		case 12 : pLayer = TestMultiTouch			::create ( ); break;
		case 13 : pLayer = TestMenu					::create ( ); break;			
		case 14	: pLayer = TestActionManager		::create ( ); break;
		case 15 : pLayer = TestLayer				::create ( ); break;	
		case 16 : pLayer = TestScene				::create ( ); break;		
		case 17 : pLayer = TestParallax				::create ( ); break;
		case 18 : pLayer = TestParallaxScrollNode	::create ( ); break;
		case 19 : pLayer = TestTileMap				::create ( ); break;	
		case 20 : pLayer = TestDiamondTile			::create ( ); break;
		case 21 : pLayer = TestInterval				::create ( ); break;
		case 22 : pLayer = TestLabel				::create ( ); break;
		case 23 : pLayer = TestFont					::create ( ); break;
		case 24 : pLayer = TestTextInput			::create ( ); break;							
		case 25 : pLayer = TestSprite				::create ( ); break;
		case 26 : pLayer = TestScheduler			::create ( ); break;
		case 27 : pLayer = TestRenderTexture		::create ( ); break;
		case 28 : pLayer = TestTexture2D			::create ( ); break;
		case 29 : pLayer = TestTextureCache			::create ( ); break;
		case 30 : pLayer = TestBox2D				::create ( ); break;
		case 31 : pLayer = TestBox2DBed				::create ( ); break;
		case 32 : pLayer = TestChipmunk				::create ( ); break;
		case 33 : pLayer = TestChipmunk2			::create ( ); break;
		case 34 : pLayer = TestEffectAdvance		::create ( ); break;	
		case 35 : pLayer = TestAccelerometer		::create ( ); break;	
		case 36 : pLayer = TestKeypad				::create ( ); break;    		
		case 37 : pLayer = TestZwoptex				::create ( ); break;
		case 38 : pLayer = TestUserDefault			::create ( ); break;
		case 39 : pLayer = TestNotificationCenter	::create ( ); break;
		case 40 : pLayer = TestControl				::create ( ); break;
		case 41 : pLayer = TestEditBox				::create ( ); break;
		case 42 : pLayer = TestTableView			::create ( ); break;
		case 43 : pLayer = TestClippingNode			::create ( ); break;
		case 44 : pLayer = TestCocosBuilder			::create ( ); break;	
		case 45 : pLayer = TestArtPig				::create ( ); break;	
		case 46 : pLayer = TestSpine				::create ( ); break;
		case 47 : pLayer = TestGB2Shape				::create ( ); break;
		case 48 : pLayer = TestVRope				::create ( ); break;
		case 49 : pLayer = TestBlade				::create ( ); break;
		case 50 : pLayer = TestDenshion				::create ( ); break;
		case 51 : pLayer = TestTTS					::create ( ); break;
		case 52 : pLayer = TestCurl					::create ( ); break;	
		case 53 : pLayer = TestNetwork				::create ( ); break;
		case 54 : pLayer = TestSqlite				::create ( ); break;
		case 55 : pLayer = TestJson					::create ( ); break;
		case 56 : pLayer = TestLocation				::create ( ); break;
		case 57 : pLayer = TestCurrentLanguage		::create ( ); break;
		case 58 : pLayer = TestFileUtils			::create ( ); break;
		case 59 : pLayer = TestAssetsManager		::create ( ); break;
		case 60 : pLayer = TestPerformance			::create ( ); break;
		case 61 : pLayer = TestBugAndSupport		::create ( ); break;
#if defined ( USE_OPEN_GLES2 )	
		case 62 : pLayer = TestShader				::create ( ); break;
#else
		case 62 : pLayer = TestGraphics				::create ( ); break;
#endif
	}

	if ( !pLayer )
	{
		return;
	}
	
	CCScene*  pScene = CCScene::create ( );
	pScene->addChild ( pLayer, nIndex );

	CCScene*  pTrans = pScene;
	if ( nIndex != 1 && nIndex != 24 ) // TestTransitions, TestSprite
	{
		/*
		switch ( eDirection )
		{
			case eDirNew	 :	pTrans = CCTransitionFadeTR			::create ( 0.5f, pScene );	break;
			case eDirClose	 :	pTrans = CCTransitionFadeBL			::create ( 0.5f, pScene );	break;
			case eDirPrev	 :	pTrans = CCTransitionMoveInL		::create ( 0.5f, pScene );	break;
			case eDirNext	 :	pTrans = CCTransitionMoveInR		::create ( 0.5f, pScene );	break;
			case eDirRestart :	pTrans = CCTransitionTurnOffTiles	::create ( 0.5f, pScene );	break;
		}
		*/
	}
	pDirector->replaceScene ( pTrans );		
}