cocoaTouch/MainMenuViewController.m
author sheepluva
Wed, 07 Apr 2010 16:03:21 +0000
changeset 3322 80afcb97eb46
parent 3321 988e39ef3c20
child 3325 652a8ebdf667
permissions -rw-r--r--
* INSTALL file: setting FreePascal to >= 2.2.0 * engine: some more value caching
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"
2799
558b29bf00c5 add a new way to fetch version info from pascal to c
koda
parents: 2743
diff changeset
    11
#import "PascalImports.h"
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    12
#import "SplitViewRootController.h"
2803
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
    13
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
    14
2685
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    15
@implementation MainMenuViewController
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    16
@synthesize cover, versionLabel;
2685
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    17
2740
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
    18
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
    19
	return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
    20
}
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
    21
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
    22
- (void)didReceiveMemoryWarning {
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
    23
	// Releases the view if it doesn't have a superview.
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    24
    self.cover = nil;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    25
    self.versionLabel = nil;
2740
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
    26
	[super didReceiveMemoryWarning];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    27
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    28
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    29
- (void)dealloc {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    30
    [versionLabel release];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    31
    [cover release];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    32
	[super dealloc];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    33
}
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    34
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    35
-(void) viewDidUnload {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    36
    self.cover = nil;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    37
	[super viewDidUnload];
2740
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
    38
}
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
    39
2687
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
    40
-(void) viewDidLoad {
3245
252be02536ab fix an error in passing strings between ObjC and Pascal
koda
parents: 3199
diff changeset
    41
    char *ver;
252be02536ab fix an error in passing strings between ObjC and Pascal
koda
parents: 3199
diff changeset
    42
    HW_versionInfo(NULL, &ver);
3199
1a9938a27677 fixes to the mac build system
koda
parents: 3063
diff changeset
    43
    NSString *versionNumber = [[NSString alloc] initWithCString:ver];
3245
252be02536ab fix an error in passing strings between ObjC and Pascal
koda
parents: 3199
diff changeset
    44
    self.versionLabel.text = versionNumber;
3199
1a9938a27677 fixes to the mac build system
koda
parents: 3063
diff changeset
    45
    [versionNumber release];
2723
eaa6ac1e95ea LANDSCAPE ON IPHONE
koda
parents: 2694
diff changeset
    46
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    47
    // listen to request to remove the modalviewcontroller
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    48
    [[NSNotificationCenter defaultCenter] addObserver:self
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    49
                                             selector:@selector(dismissModalViewController)
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    50
                                                 name: @"dismissModalView" 
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    51
                                               object:nil];
3321
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    52
    
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    53
    // initialize some files the first time we load the game
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    54
    NSString *filePath = [[SDLUIKitDelegate sharedAppDelegate] dataFilePath:@"settings.plist"];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    55
	if (!([[NSFileManager defaultManager] fileExistsAtPath:filePath])) 
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    56
        [NSThread detachNewThreadSelector:@selector(checkFirstRun) toTarget:self withObject:nil];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    57
    
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    58
	[super viewDidLoad];
2685
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    59
}
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
    60
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    61
// this is called to verify whether it's the first time the app is launched
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
    62
// if it is it blocks user interaction with an alertView until files are created
2803
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
    63
-(void) checkFirstRun {
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
    64
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
3321
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    65
    NSLog(@"First time run, creating settings files");
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    66
    
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    67
    // show a popup with an indicator to make the user wait
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    68
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Please wait",@"")
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    69
                                                    message:nil
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    70
                                                   delegate:nil
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    71
                                          cancelButtonTitle:nil
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    72
                                          otherButtonTitles:nil];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    73
    [alert show];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    74
    
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    75
    UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] 
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    76
                                          initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    77
    indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    78
    [indicator startAnimating];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    79
    [alert addSubview:indicator];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    80
    [indicator release];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    81
    [alert release];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    82
    
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    83
    // create Default Team.plist
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    84
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    85
    NSString *teamsDirectory = [[paths objectAtIndex:0] stringByAppendingString:@"/Teams/"];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    86
    [[NSFileManager defaultManager] createDirectoryAtPath:teamsDirectory 
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    87
                              withIntermediateDirectories:NO 
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    88
                                               attributes:nil 
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    89
                                                    error:NULL];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    90
    
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    91
    NSMutableArray *hedgehogs = [[NSMutableArray alloc] init];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    92
    
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    93
    for (int i = 0; i < 8; i++) {
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    94
        NSString *hogName = [[NSString alloc] initWithFormat:@"hedgehog %d",i];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    95
        NSDictionary *hog = [[NSDictionary alloc] initWithObjectsAndKeys:@"100",@"health",@"0",@"level",
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    96
                             hogName,@"hogname",@"NoHat",@"hat",nil];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    97
        [hogName release];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    98
        [hedgehogs addObject:hog];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
    99
        [hog release];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   100
    }
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   101
    
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   102
    NSDictionary *defaultTeam = [[NSDictionary alloc] initWithObjectsAndKeys:@"4421353",@"color",@"0",@"hash",
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   103
                                 @"Default Team",@"teamname",@"Statue",@"grave",@"Plane",@"fort",
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   104
                                 @"Default",@"voicepack",@"hedgewars",@"flag",hedgehogs,@"hedgehogs",nil];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   105
    [hedgehogs release];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   106
    NSString *defaultTeamFile = [teamsDirectory stringByAppendingString:@"Default Team.plist"];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   107
    [defaultTeam writeToFile:defaultTeamFile atomically:YES];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   108
    [defaultTeam release];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   109
    
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   110
    // create settings.plist
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   111
    NSMutableDictionary *saveDict = [[NSMutableDictionary alloc] init];
2803
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
   112
	
3321
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   113
    [saveDict setObject:@"" forKey:@"username"];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   114
    [saveDict setObject:@"" forKey:@"password"];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   115
    [saveDict setObject:@"1" forKey:@"music"];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   116
    [saveDict setObject:@"1" forKey:@"sounds"];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   117
    [saveDict setObject:@"0" forKey:@"alternate"];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   118
3321
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   119
    NSString *filePath = [[SDLUIKitDelegate sharedAppDelegate] dataFilePath:@"settings.plist"];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   120
    [saveDict writeToFile:filePath atomically:YES];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   121
    [saveDict release];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   122
    
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   123
    // create other files
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   124
    
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   125
    // ok let the user take control
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   126
    [alert dismissWithClickedButtonIndex:0 animated:YES];
988e39ef3c20 rewrote a couple of things i didn't like
koda
parents: 3317
diff changeset
   127
2803
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
   128
	[pool release];
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
   129
	[NSThread exit];
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
   130
}
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
   131
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   132
#pragma mark -
3027
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   133
-(void) appear {
3029
67483e87590c a couple of smaller cleanups that didn't get in previous commit
koda
parents: 3027
diff changeset
   134
    [[SDLUIKitDelegate sharedAppDelegate].uiwindow addSubview:self.view];
3063
0092dc37fbd6 reworked interaction of engine/frontend when closing
koda
parents: 3034
diff changeset
   135
    [self release];
0092dc37fbd6 reworked interaction of engine/frontend when closing
koda
parents: 3034
diff changeset
   136
    
3027
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   137
    [UIView beginAnimations:@"inserting main controller" context:NULL];
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   138
	[UIView setAnimationDuration:1];
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   139
	self.view.alpha = 1;
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   140
	[UIView commitAnimations];
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   141
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   142
    [NSTimer scheduledTimerWithTimeInterval:0.7 target:self selector:@selector(hideBehind) userInfo:nil repeats:NO];
3027
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   143
}
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   144
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   145
-(void) disappear {
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   146
    if (nil != cover)
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   147
        [cover release];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   148
    
3027
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   149
    [UIView beginAnimations:@"removing main controller" context:NULL];
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   150
	[UIView setAnimationDuration:1];
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   151
	self.view.alpha = 0;
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   152
	[UIView commitAnimations];
3063
0092dc37fbd6 reworked interaction of engine/frontend when closing
koda
parents: 3034
diff changeset
   153
    [self retain];
3317
198ec44b6d92 minor tweaks, icon for ipad, merged overlayviewcontroller, pop viewcontroller when selected a hat
koda
parents: 3315
diff changeset
   154
    //[self.view removeFromSuperview];
3027
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   155
}
32890edaa483 lotsa optimizations and redraws for the iFrontend
koda
parents: 3026
diff changeset
   156
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   157
// this is a silly way to hide the sdl contex that remained active
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   158
-(void) hideBehind {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   159
    if (nil == cover) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   160
        cover= [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   161
        cover.backgroundColor = [UIColor blackColor];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   162
    }
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   163
    [[SDLUIKitDelegate sharedAppDelegate].uiwindow insertSubview:cover belowSubview:self.view];
2687
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
   164
}
28b8330b8af1 add stub files for other views and prevent useless crashes
koda
parents: 2685
diff changeset
   165
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   166
#pragma mark -
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   167
-(IBAction) switchViews:(id) sender {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   168
    UIButton *button = (UIButton *)sender;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   169
    SplitViewRootController *splitViewController;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   170
    UIAlertView *alert;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   171
    
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   172
    switch (button.tag) {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   173
        case 0:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   174
            [[SDLUIKitDelegate sharedAppDelegate] startSDLgame];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   175
            break;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   176
        case 2:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   177
            // for now this controller is just to simplify code management
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   178
            splitViewController = [[SplitViewRootController alloc] initWithNibName:nil bundle:nil];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   179
            splitViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   180
            [self presentModalViewController:splitViewController animated:YES];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   181
            break;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   182
        default:
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   183
            alert = [[UIAlertView alloc] initWithTitle:@"Not Yet Implemented"
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   184
                                               message:@"Sorry, this feature is not yet implemented"
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   185
                                              delegate:nil
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   186
                                     cancelButtonTitle:@"Well, don't worry"
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   187
                                     otherButtonTitles:nil];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   188
            [alert show];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   189
            [alert release];
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   190
            break;
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   191
    }
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   192
}
2740
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
   193
3305
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   194
-(void) dismissModalViewController {
91074496d5c9 merged code from ipad and iphone frontends
koda
parents: 3245
diff changeset
   195
    [self dismissModalViewControllerAnimated:YES];
2740
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
   196
}
03df0573a9fd programmatically load main controller
koda
parents: 2738
diff changeset
   197
2685
0ba746be5d59 frontend images by Tiy, first setup of frontend
koda
parents:
diff changeset
   198
@end