equal
deleted
inserted
replaced
131 a = 0; |
131 a = 0; |
132 b = 180; |
132 b = 180; |
133 } |
133 } |
134 |
134 |
135 // get the number of screens to know the previous state whan a display is connected or detached |
135 // get the number of screens to know the previous state whan a display is connected or detached |
136 initialScreenCount = [[UIScreen screens] count]; |
136 if ([UIScreen respondsToSelector:@selector(screens)]) |
|
137 initialScreenCount = [[UIScreen screens] count]; |
|
138 else |
|
139 initialScreenCount = 1; |
137 |
140 |
138 // set initial orientation of the controller orientation |
141 // set initial orientation of the controller orientation |
139 if (IS_DUALHEAD()) { |
142 if (IS_DUALHEAD()) { |
140 switch (self.interfaceOrientation) { |
143 switch (self.interfaceOrientation) { |
141 case UIDeviceOrientationLandscapeLeft: |
144 case UIDeviceOrientationLandscapeLeft: |
173 |
176 |
174 [[NSNotificationCenter defaultCenter] addObserver:self |
177 [[NSNotificationCenter defaultCenter] addObserver:self |
175 selector:@selector(cleanup) |
178 selector:@selector(cleanup) |
176 name:@"remove overlay" |
179 name:@"remove overlay" |
177 object:nil]; |
180 object:nil]; |
178 |
181 |
179 [[NSNotificationCenter defaultCenter] addObserver:self |
182 // for iOS > 3.2 |
180 selector:@selector(numberOfScreensIncreased) |
183 if ([UIScreen respondsToSelector:@selector(screens)]) { |
181 name:UIScreenDidConnectNotification |
184 [[NSNotificationCenter defaultCenter] addObserver:self |
182 object:nil]; |
185 selector:@selector(numberOfScreensIncreased) |
183 |
186 name:UIScreenDidConnectNotification |
184 [[NSNotificationCenter defaultCenter] addObserver:self |
187 object:nil]; |
185 selector:@selector(numberOfScreensDecreased) |
188 |
186 name:UIScreenDidDisconnectNotification |
189 [[NSNotificationCenter defaultCenter] addObserver:self |
187 object:nil]; |
190 selector:@selector(numberOfScreensDecreased) |
|
191 name:UIScreenDidDisconnectNotification |
|
192 object:nil]; |
|
193 } |
188 |
194 |
189 // present the overlay |
195 // present the overlay |
190 [UIView beginAnimations:@"showing overlay" context:NULL]; |
196 [UIView beginAnimations:@"showing overlay" context:NULL]; |
191 [UIView setAnimationDuration:1]; |
197 [UIView setAnimationDuration:1]; |
192 self.view.alpha = 1; |
198 self.view.alpha = 1; |
232 doNotDim(); |
238 doNotDim(); |
233 } |
239 } |
234 |
240 |
235 -(void) cleanup { |
241 -(void) cleanup { |
236 [self dismissPopover]; |
242 [self dismissPopover]; |
|
243 setGameRunning(NO); |
237 HW_terminate(NO); |
244 HW_terminate(NO); |
238 [self.view removeFromSuperview]; |
245 [self.view removeFromSuperview]; |
239 } |
246 } |
240 |
247 |
241 -(void) didReceiveMemoryWarning { |
248 -(void) didReceiveMemoryWarning { |