Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 85 lines (63 sloc) 2.451 kb
9485d3d Initial Commit
Robert Righter authored
1 //
2 // chopper_hopperAppDelegate.m
3 // chopper-hopper
4 //
5 // Created by Robert Righter on 3/8/10.
6 // Copyright Medium 2010. All rights reserved.
7 //
8
9 #import "chopper_hopperAppDelegate.h"
10 #import "cocos2d.h"
11 #import "ChopHop.h"
12
13 @implementation chopper_hopperAppDelegate
14
15 @synthesize window;
16
17 - (void) applicationDidFinishLaunching:(UIApplication*)application
18 {
19 // Init the window
20 window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
21
22 // cocos2d will inherit these values
23 [window setUserInteractionEnabled:YES];
24 [window setMultipleTouchEnabled:YES];
25
26 // Try to use CADisplayLink director
27 // if it fails (SDK < 3.1) use the default director
28 if( ! [CCDirector setDirectorType:CCDirectorTypeDisplayLink] )
29 [CCDirector setDirectorType:CCDirectorTypeDefault];
30
31 // Use RGBA_8888 buffers
32 // Default is: RGB_565 buffers
33 [[CCDirector sharedDirector] setPixelFormat:kPixelFormatRGBA8888];
34
35 // Create a depth buffer of 16 bits
36 // Enable it if you are going to use 3D transitions or 3d objects
37 // [[CCDirector sharedDirector] setDepthBufferFormat:kDepthBuffer16];
38
39 // Default texture format for PNG/BMP/TIFF/JPEG/GIF images
40 // It can be RGBA8888, RGBA4444, RGB5_A1, RGB565
41 // You can change anytime.
42 [CCTexture2D setDefaultAlphaPixelFormat:kTexture2DPixelFormat_RGBA8888];
43
44 // before creating any layer, set the landscape mode
45 [[CCDirector sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];
46 [[CCDirector sharedDirector] setAnimationInterval:1.0/60];
47 [[CCDirector sharedDirector] setDisplayFPS:YES];
48
49 // create an openGL view inside a window
50 [[CCDirector sharedDirector] attachInView:window];
51 [window makeKeyAndVisible];
52
53
54 [[CCDirector sharedDirector] runWithScene: [ChopHop scene]];
55 }
56
57
58 - (void)applicationWillResignActive:(UIApplication *)application {
59 [[CCDirector sharedDirector] pause];
60 }
61
62 - (void)applicationDidBecomeActive:(UIApplication *)application {
63 [[CCDirector sharedDirector] resume];
64 }
65
66 - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
67 [[CCTextureCache sharedTextureCache] removeUnusedTextures];
68 }
69
70 - (void)applicationWillTerminate:(UIApplication *)application {
71 [[CCDirector sharedDirector] end];
72 }
73
74 - (void)applicationSignificantTimeChange:(UIApplication *)application {
75 [[CCDirector sharedDirector] setNextDeltaTimeZero:YES];
76 }
77
78 - (void)dealloc {
79 [[CCDirector sharedDirector] release];
80 [window release];
81 [super dealloc];
82 }
83
84 @end
Something went wrong with that request. Please try again.