86 GameSetup *setup = [[GameSetup alloc] init]; |
86 GameSetup *setup = [[GameSetup alloc] init]; |
87 [setup startThread:@"engineProtocol"]; |
87 [setup startThread:@"engineProtocol"]; |
88 const char **gameArgs = [setup getSettings]; |
88 const char **gameArgs = [setup getSettings]; |
89 [setup release]; |
89 [setup release]; |
90 |
90 |
91 //NSLog(@"%@",[[[UIApplication sharedApplication] windows]); |
|
92 // since the sdlwindow is not yet created, we add the overlayController with a delay |
91 // since the sdlwindow is not yet created, we add the overlayController with a delay |
93 [self performSelector:@selector(later) withObject:nil afterDelay:4]; |
92 [self performSelector:@selector(displayOverlayLater) withObject:nil afterDelay:4]; |
94 |
93 |
95 // this is the pascal fuction that starts the game (wrapped around isInGame) |
94 // this is the pascal fuction that starts the game (wrapped around isInGame) |
96 isInGame = YES; |
95 isInGame = YES; |
97 Game(gameArgs); |
96 Game(gameArgs); |
98 isInGame = NO; |
97 isInGame = NO; |
99 |
98 |
100 free(gameArgs); |
99 free(gameArgs); |
101 //[overlayController.view removeFromSuperview]; |
|
102 |
100 |
103 [UIView beginAnimations:@"inserting main controller" context:NULL]; |
101 [UIView beginAnimations:@"inserting main controller" context:NULL]; |
104 [UIView setAnimationDuration:1]; |
102 [UIView setAnimationDuration:1]; |
105 mainViewController.view.alpha = 1; |
103 mainViewController.view.alpha = 1; |
106 [UIView commitAnimations]; |
104 [UIView commitAnimations]; |
107 } |
105 } |
108 |
106 |
109 -(void) later { |
107 -(void) displayOverlayLater { |
110 // overlay with controls, become visible after 4 seconds, with a transparency effect |
108 // overlay with controls, become visible after 4 seconds, with a transparency effect |
111 OverlayViewController *overlayController = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil]; |
109 OverlayViewController *overlayController = [[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil]; |
112 |
110 |
113 [[[UIApplication sharedApplication] keyWindow] addSubview:overlayController.view]; |
111 [[[UIApplication sharedApplication] keyWindow] addSubview:overlayController.view]; |
114 [overlayController release]; |
112 [overlayController release]; |