cocoaTouch/MainMenuViewController.m
author koda
Thu, 14 Jan 2010 16:38:43 +0000
changeset 2694 dcd248e04f3d
parent 2687 28b8330b8af1
child 2723 eaa6ac1e95ea
permissions -rw-r--r--
can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2685
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
     1
//
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
     2
//  MainMenuViewController.m
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
     3
//  hwengine
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
     4
//
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
     5
//  Created by Vittorio on 08/01/10.
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
     6
//  Copyright 2010 __MyCompanyName__. All rights reserved.
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
     7
//
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
     8
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
     9
#import "MainMenuViewController.h"
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    10
#import "SDL_uikitappdelegate.h"
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    11
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    12
@implementation MainMenuViewController
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    13
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    14
@synthesize passandplayButton, netplayButton, storeButton, versionLabel;
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    15
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    16
/*
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    17
 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    18
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    19
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    20
        // Custom initialization
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    21
    }
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    22
    return self;
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    23
}
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    24
*/
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    25
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    26
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    27
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
2687
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    28
-(void) viewDidLoad {
2694
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    29
	self.versionLabel.text = @"Hedgewars version 0.9.13-dev";
2685
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    30
    [super viewDidLoad];
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    31
}
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    32
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    33
/*
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    34
// Override to allow orientations other than the default portrait orientation.
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    35
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    36
    // Return YES for supported orientations
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    37
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    38
}
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    39
*/
2694
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    40
/*
2685
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    41
- (void)didReceiveMemoryWarning {
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    42
	// Releases the view if it doesn't have a superview.
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    43
    [super didReceiveMemoryWarning];
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    44
	
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    45
	// Release any cached data, images, etc that aren't in use.
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    46
}
2694
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    47
*/
2685
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    48
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    49
- (void)viewDidUnload {
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    50
	// Release any retained subviews of the main view.
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    51
	self.passandplayButton = nil;
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    52
	self.netplayButton = nil;
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    53
	self.storeButton = nil;
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    54
	self.versionLabel = nil;
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    55
}
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    56
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    57
- (void)dealloc {
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    58
	[passandplayButton release];
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    59
	[netplayButton release];
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    60
	[storeButton release];
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    61
	[versionLabel release];
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    62
    [super dealloc];
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    63
}
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    64
2694
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    65
// disable the buttons when to prevent launching twice the game
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    66
-(void) viewWillDisappear:(BOOL)animated {
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    67
	passandplayButton.enabled = NO;
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    68
	netplayButton.enabled = NO;
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    69
	storeButton.enabled = NO;
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    70
	[super viewWillDisappear:animated];
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    71
}
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    72
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    73
-(void) viewWillAppear:(BOOL)animated {
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    74
	passandplayButton.enabled = YES;
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    75
	netplayButton.enabled = YES;
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    76
	storeButton.enabled = YES;
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    77
	[super viewWillAppear:animated];
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    78
}
dcd248e04f3d can use latest sdlimage, work on setting panel and option when launching the game, minor fixes
koda
parents: 2687
diff changeset
    79
2685
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    80
-(IBAction) startPlaying {
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    81
	[[SDLUIKitDelegate sharedAppDelegate] startSDLgame];
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    82
}
2687
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    83
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    84
-(IBAction) notYetImplemented {
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    85
	UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    86
									message:@"Sorry, this feature is not yet implemented"
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    87
									delegate:nil
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    88
									cancelButtonTitle:@"Well, don't worry"
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    89
									otherButtonTitles:nil];
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    90
	[alert show];
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    91
	[alert release];
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    92
}
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    93
2685
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    94
@end