Advertisement
Guest User

Untitled

a guest
Mar 26th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  2. {
  3.     // Create the main window
  4.     window_ = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  5.  
  6.  
  7.     // Create an CCGLView with a RGB565 color buffer, and a depth buffer of 0-bits
  8.     CCGLView *glView = [CCGLView viewWithFrame:[window_ bounds]
  9.                                    pixelFormat:kEAGLColorFormatRGB565   //kEAGLColorFormatRGBA8
  10.                                    depthFormat:0    //GL_DEPTH_COMPONENT24_OES
  11.                             preserveBackbuffer:NO
  12.                                     sharegroup:nil
  13.                                  multiSampling:NO
  14.                                numberOfSamples:0];
  15.     director_ = (CCDirectorIOS*) [CCDirector sharedDirector];
  16.  
  17.     director_.wantsFullScreenLayout = YES;
  18.  
  19.     // Display FSP and SPF
  20.     [director_ setDisplayStats:YES];
  21.  
  22.     // set FPS at 60
  23.     [director_ setAnimationInterval:1.0/60];
  24.  
  25.     // attach the openglView to the director
  26.     [director_ setView:glView];
  27.  
  28.     // for rotation and other messages
  29.     [director_ setDelegate:self];
  30.  
  31.     [glView setMultipleTouchEnabled:YES];
  32.    
  33.     // 2D projection
  34.     [director_ setProjection:kCCDirectorProjection2D];
  35. //  [director setProjection:kCCDirectorProjection3D];
  36.  
  37.     // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
  38.     if( ! [director_ enableRetinaDisplay:YES] )
  39.         CCLOG(@"This device is not retina");
  40.  
  41.     // Create a Navigation Controller with the Director
  42.     navController_ = [[UINavigationController alloc] initWithRootViewController:director_];
  43.     navController_.navigationBarHidden = YES;
  44.  
  45.     // set the Navigation Controller as the root view controller
  46. //  [window_ setRootViewController:rootViewController_];
  47.     [window_ addSubview:navController_.view];
  48.  
  49.     // make main window visible
  50.     [window_ makeKeyAndVisible];
  51.  
  52.     // Default texture format for PNG/BMP/TIFF/JPEG/GIF images
  53.     // It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
  54.     // You can change anytime.
  55.     [CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
  56.  
  57.     // When in iPad / RetinaDisplay mode, CCFileUtils will append the "-ipad" / "-hd" to all loaded files
  58.     // If the -ipad  / -hdfile is not found, it will load the non-suffixed version
  59.     [CCFileUtils setiPadSuffix:@"-ipad"];           // Default on iPad is "" (empty string)
  60.     [CCFileUtils setRetinaDisplaySuffix:@"@2x"];    // Default on RetinaDisplay is "-hd"
  61.  
  62.     // Assume that PVR images have premultiplied alpha
  63.     [CCTexture2D PVRImagesHavePremultipliedAlpha:YES];
  64.  
  65.     // and add the scene to the stack. The director will run it when it automatically when the view is displayed.
  66.     [director_ pushScene: [MainMenu scene]];
  67.    
  68.    
  69.    
  70.     return YES;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement