summary refs log tree commit diff stats
path: root/Classes/MainMenuLayer.m
blob: d4a63313d7ff01da0941b24a542743869a302979 (plain) (blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//
//  MainMenuLayer.m
//  Cart Collect
//
//  Created by iD Student Account on 7/20/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "MainMenuLayer.h"
#import "HighscoreListController.h"
#import "GameModeSelectionLayer.h"
#import "Cart_CollectAppDelegate.h"
#import "TestFlight.h"

@implementation MainMenuLayer

+ (CCScene*)scene
{
	CCScene* scene = [CCScene node];
	
	MainMenuLayer* layer = [MainMenuLayer node];
	[scene addChild:layer];
	
	return scene;
}

- (id)init
{
	self = [super init];
	 
	if (nil != self)
	{
		CCSprite* backgroundImage = [CCSprite spriteWithFile:@"SeaBeach.png"];
		backgroundImage.position = ccp(240,160);
		[self addChild:backgroundImage];
		
		CCLabelBMFont* titleText = [CCLabelBMFont labelWithString:@"Cartographic - The Game!" fntFile:@"getoffthatboatrightnowyounglady.fnt"];
		titleText.position = ccp(240, 320-64);
		[self addChild:titleText];
		
		//CCLabelBMFont* menuItemLabel1 = [CCLabelBMFont labelWithString:@"New Game" fntFile:@"getoffthatboatrightnowyounglady.fnt"];
		//CCMenuItemLabel* menuItem1 = [CCMenuItemLabel itemWithLabel:menuItemLabel1 target:self selector:@selector(newgame)];
		
		//CCLabelBMFont* menuItemLabel2 = [CCLabelBMFont labelWithString:@"Highscores" fntFile:@"getoffthatboatrightnowyounglady.fnt"];
		//CCMenuItemLabel* menuItem2 = [CCMenuItemLabel itemWithLabel:menuItemLabel2 target:self selector:@selector(highscores)];
		
		CCMenuItemImage* newgameMenuItem = [CCMenuItemImage itemFromNormalImage:@"newgame.png" selectedImage:@"newgame2.png" target:self selector:@selector(newgame)];
		CCMenuItemImage* highscoresMenuItem = [CCMenuItemImage itemFromNormalImage:@"highscores.png" selectedImage:@"highscores2.png" target:self selector:@selector(highscores)];
		CCMenuItemImage* feedbackMenuItem = [CCMenuItemImage itemFromNormalImage:@"feedback.png" selectedImage:@"feedback2.png" target:self selector:@selector(feedback)];

		CCMenu* menu = [CCMenu menuWithItems:newgameMenuItem, highscoresMenuItem, feedbackMenuItem, nil];
		[menu alignItemsVertically];
		menu.position = ccp(240, 100);
		[self addChild:menu];
	}
	
	return self;
}

- (void)newgame
{
    [[CCDirector sharedDirector] replaceScene:[GameModeSelectionLayer scene]];
}

- (void)highscores
{
	HighscoreListController* listController = [[HighscoreListController alloc] initWithStyle:UITableViewStylePlain];
    Cart_CollectAppDelegate* appDelegate = ((Cart_CollectAppDelegate*) [[UIApplication sharedApplication] delegate]);
	[[appDelegate window] setRootViewController:listController];
    [listController release];
}

- (void)feedback
{
    [TestFlight openFeedbackView];
}

@end