paytonrules (owner)

Revisions

gist: 215062 Download_button fork
public
Public Clone URL: git://gist.github.com/215062.git
Embed All Files: show embed
Objective-C #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-(void) initializeDirector
{
// before creating any layer, set the landscape mode
// Initialize Director
[[Director sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
[[Director sharedDirector] setAnimationInterval:1.0/60];
[[Director sharedDirector] setDisplayFPS:YES];
 
 
// create an openGL view inside a window
[[Director sharedDirector] attachInView:window];
 
[[Director sharedDirector] runWithScene: [GameScene scene]];
}
 
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
// Init the window
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
 
// cocos2d will inherit these values
[window setUserInteractionEnabled:YES];
[window setMultipleTouchEnabled:YES];
[window makeKeyAndVisible];
 
// must be called before any othe call to the director
// WARNING: FastDirector doesn't interact well with UIKit controls
// [Director useFastDirector];
 
// Default texture format for PNG/BMP/TIFF/JPEG/GIF images
// It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
// You can change anytime.
[Texture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];
 
[self initializeDirector];
}