equal
deleted
inserted
replaced
64 |
64 |
65 -(id) init { |
65 -(id) init { |
66 if (self = [super init]){ |
66 if (self = [super init]){ |
67 self.uiwindow = nil; |
67 self.uiwindow = nil; |
68 self.window = NULL; |
68 self.window = NULL; |
69 viewController = nil; |
69 mainViewController = nil; |
70 isInGame = NO; |
70 isInGame = NO; |
71 return self; |
71 return self; |
72 } else |
72 } else |
73 return nil; |
73 return nil; |
74 } |
74 } |
75 |
75 |
76 -(void) dealloc { |
76 -(void) dealloc { |
77 SDL_DestroyWindow(self.window); |
77 SDL_DestroyWindow(self.window); |
78 [viewController release]; |
78 [mainViewController release]; |
79 [uiwindow release]; |
79 [uiwindow release]; |
80 [super dealloc]; |
80 [super dealloc]; |
81 } |
81 } |
82 |
82 |
83 // main routine for calling the actual game engine |
83 // main routine for calling the actual game engine |
84 -(IBAction) startSDLgame { |
84 -(IBAction) startSDLgame { |
85 [viewController disappear]; |
85 [mainViewController disappear]; |
86 |
86 |
87 // pull out useful configuration info from various files |
87 // pull out useful configuration info from various files |
88 GameSetup *setup = [[GameSetup alloc] init]; |
88 GameSetup *setup = [[GameSetup alloc] init]; |
89 [setup startThread:@"engineProtocol"]; |
89 [setup startThread:@"engineProtocol"]; |
90 const char **gameArgs = [setup getSettings]; |
90 const char **gameArgs = [setup getSettings]; |
102 isInGame = NO; |
102 isInGame = NO; |
103 |
103 |
104 free(gameArgs); |
104 free(gameArgs); |
105 [overlayController.view removeFromSuperview]; |
105 [overlayController.view removeFromSuperview]; |
106 |
106 |
107 [viewController appear]; |
107 [mainViewController appear]; |
108 } |
108 } |
109 |
109 |
110 // override the direct execution of SDL_main to allow us to implement the frontend (even using a nib) |
110 // override the direct execution of SDL_main to allow us to implement the frontend (even using a nib) |
111 -(void) applicationDidFinishLaunching:(UIApplication *)application { |
111 -(void) applicationDidFinishLaunching:(UIApplication *)application { |
112 //[application setStatusBarHidden:YES animated:NO]; |
112 //[application setStatusBarHidden:YES animated:NO]; |
116 |
116 |
117 self.uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
117 self.uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
118 self.uiwindow.backgroundColor = [UIColor blackColor]; |
118 self.uiwindow.backgroundColor = [UIColor blackColor]; |
119 |
119 |
120 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) |
120 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) |
121 viewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPad" bundle:nil]; |
121 mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPad" bundle:nil]; |
122 else |
122 else |
123 viewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPhone" bundle:nil]; |
123 mainViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController-iPhone" bundle:nil]; |
124 [uiwindow addSubview:viewController.view]; |
124 [uiwindow addSubview:mainViewController.view]; |
125 |
125 |
126 // Set working directory to resource path |
126 // Set working directory to resource path |
127 [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]]; |
127 [[NSFileManager defaultManager] changeCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]]; |
128 |
128 |
129 [uiwindow makeKeyAndVisible]; |
129 [uiwindow makeKeyAndVisible]; |