# CCAppDelegate Class Reference

Inherits from | NSObject
Conforms to | CCDirectorDelegate UIApplicationDelegate
Declared in | CCAppDelegate.h

## Overview

Most Cocos2d apps should override the CCAppDelegate, it serves as the apps starting point. By the very least, the startScene method should be overridden to return the first scene the app should display. To further customize the behavior of Cocos2d, such as the screen mode of pixel format, override the applicaton:didFinishLaunchingWithOptions: method.

## Tasks

### Accessing Window and Navigation Controller

- `window` property
- `navController` property

### Setting Up the Start Scene

- `– startScene`

### Cocos2d Configuration

- `– setupCocos2dWithOptions:`

## Properties

### navController

The navigation controller that Cocos2d is using.

`@property (atomic, readonly) CCNavigationController *navController`

#### Declared In

`CCAppDelegate.h`

### window

The window used to display the Cocos2d content.

`@property (nonatomic, strong) UIWindow *window`

#### Declared In

`CCAppDelegate.h`

## Instance Methods

### setupCocos2dWithOptions:

This method is normally called from the applicaton:didFinishLaunchingWithOptions: method. It will configure Cocos2d with the options that you provide. You can leave out any of the options and Cocos2d will use the default values.

`- (void)setupCocos2dWithOptions:(NSDictionary *)config`

#### Parameters

config

  Dictionary with options for configuring Cocos2d.

#### Discussion

Currently supported keys for the configuration dictionary are:

- CCSetupPixelFormat NSString with the pixel format, normally kEAGLColorFormatRGBA8 or kEAGLColorFormatRGB565. The RGB565 option is faster, but will allow less colors.
- CCSetupScreenMode NSString value that accepts either CCScreenModeFlexible or CCScreenModeFixed.
- CCSetupScreenOrientation NSString value that accepts CCScreenOrientationLandscape, CCScreenOrientationPortrait, or CCScreenOrientationAll.
- CCSetupAnimationInterval NSNumber with double. Specifies the desired interval between animation frames. Supported values are 1.0/60.0 (default) and 1.0/30.0.
- CCSetupFixedUpdateInterval NSNumber with double. Specifies the desired interval between fixed updates.Should be smaller than CCSetupAnimationInterval. Defaults to 1/60.0.
- CCSetupShowDebugStats NSNumber with bool. Specifies if the stats (FPS, frame time and draw call count) should be shown. Defaults to NO.

- CCSetupTabletScale2X NSNumber with bool. If true, the iPad will be setup to act like it has a 512x384 “retina” screen. This makes it much easier to make universal iOS games. This value is ignored when using the fixed screen mode.

- CCSetupDepthFormat NSNumber with integer. Specifies the desired depth format. Values are 0, GL_DEPTH_COMPONENT24_OES and GL_DEPTH24_STENCIL8_OES.

- CCSetupPreserveBackbuffer NSNumber with bool. Specifies whether backbuffer will be preserved.
- CCSetupMultiSampling NSNumber with bool. Specifies whether miltisampling is enabled.
- CCSetupNumberOfSamples NSNumber with integer. Specifies number of samples when multisampling is enabled.

#### Declared In

`CCAppDelegate.h`

### startScene

Override this method to return the first scene that Cocos2d should display.

`- (CCScene *)startScene`

#### Return Value

Starting scene for your app.

#### Declared In

`CCAppDelegate.h`