project_files/HedgewarsMobile/Classes/OverlayViewController.m
changeset 5177 b850b544addc
parent 5175 a3da220dbb3f
child 5195 1bfa81f0bc21
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Mon Apr 25 17:56:26 2011 -0400
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Tue Apr 26 02:36:40 2011 +0200
@@ -26,8 +26,6 @@
 #import "PascalImports.h"
 #import "CommodityFunctions.h"
 #import "CGPointUtils.h"
-#import "SDL_config_iphoneos.h"
-#import "SDL_mouse.h"
 #import "ObjcExports.h"
 
 #define HIDING_TIME_DEFAULT [NSDate dateWithTimeIntervalSinceNow:2.7]
@@ -55,8 +53,14 @@
     if (isGameRunning() == NO)
         return;
 
+    UIView *sdlView = nil;
+    for (UIView *oneView in [[[UIApplication sharedApplication] keyWindow] subviews])
+        if ([oneView isMemberOfClass:[SDL_uikitopenglview class]]) {
+            sdlView = (UIView *)oneView;
+            break;
+        }
+
     UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
-    UIView *sdlView = [[[UIApplication sharedApplication] keyWindow] viewWithTag:SDL_VIEW_TAG];
     NSInteger angle_left = (self.initialOrientation == UIInterfaceOrientationLandscapeLeft) ? 180 : 0;
     NSInteger angle_right = (self.initialOrientation == UIInterfaceOrientationLandscapeLeft) ? 0 : 180;