summary refs log tree commit diff stats
path: root/Classes/MainMenuLayer.m
diff options
context:
space:
mode:
Diffstat (limited to 'Classes/MainMenuLayer.m')
-rwxr-xr-xClasses/MainMenuLayer.m68
1 files changed, 68 insertions, 0 deletions
diff --git a/Classes/MainMenuLayer.m b/Classes/MainMenuLayer.m new file mode 100755 index 0000000..ac7f4a7 --- /dev/null +++ b/Classes/MainMenuLayer.m
@@ -0,0 +1,68 @@
1//
2// MainMenuLayer.m
3// Cart Collect
4//
5// Created by iD Student Account on 7/20/11.
6// Copyright 2011 __MyCompanyName__. All rights reserved.
7//
8
9#import "MainMenuLayer.h"
10
11
12@implementation MainMenuLayer
13
14+ (CCScene*)scene
15{
16 CCScene* scene = [CCScene node];
17
18 MainMenuLayer* layer = [MainMenuLayer node];
19 [scene addChild:layer];
20
21 return scene;
22}
23
24- (id)init
25{
26 self = [super init];
27
28 if (nil != self)
29 {
30 CCSprite* backgroundImage = [CCSprite spriteWithFile:@"SeaBeach.png"];
31 backgroundImage.position = ccp(240,160);
32 [self addChild:backgroundImage];
33
34 CCLabelBMFont* titleText = [CCLabelBMFont labelWithString:@"Cart Collect - The Game!" fntFile:@"getoffthatboatrightnowyounglady.fnt"];
35 titleText.position = ccp(240, 320-64);
36 [self addChild:titleText];
37
38 //CCLabelBMFont* menuItemLabel1 = [CCLabelBMFont labelWithString:@"New Game" fntFile:@"getoffthatboatrightnowyounglady.fnt"];
39 //CCMenuItemLabel* menuItem1 = [CCMenuItemLabel itemWithLabel:menuItemLabel1 target:self selector:@selector(newgame)];
40
41 //CCLabelBMFont* menuItemLabel2 = [CCLabelBMFont labelWithString:@"Highscores" fntFile:@"getoffthatboatrightnowyounglady.fnt"];
42 //CCMenuItemLabel* menuItem2 = [CCMenuItemLabel itemWithLabel:menuItemLabel2 target:self selector:@selector(highscores)];
43
44 CCMenuItemImage* menuItem1 = [CCMenuItemImage itemFromNormalImage:@"newgame.png" selectedImage:@"newgame2.png" target:self selector:@selector(newgame)];
45 CCMenuItemImage* menuItem2 = [CCMenuItemImage itemFromNormalImage:@"highscores.png" selectedImage:@"highscores2.png" target:self selector:@selector(highscores)];
46
47 CCMenu* menu = [CCMenu menuWithItems:menuItem1, menuItem2, nil];
48 [menu alignItemsVertically];
49 menu.position = ccp(240, 100);
50 [self addChild:menu];
51 }
52
53 return self;
54}
55
56- (void)newgame
57{
58 [[CCDirector sharedDirector] replaceScene:[GameLayer scene]];
59}
60
61- (void)highscores
62{
63 HighscoreListController* listController = [[HighscoreListController alloc] initWithStyle:UITableViewStylePlain];
64 [[[[UIApplication sharedApplication] delegate] window] setRootViewController:listController];
65 [listController release];
66}
67
68@end