more ios pages supporting rotaiton
authorkoda
Mon, 30 Jan 2012 23:20:28 +0100
changeset 6615 65602f1ef0f8
parent 6614 f88f67a17a9d
child 6616 f77bb02b669f
more ios pages supporting rotaiton
project_files/HedgewarsMobile/Classes/ExtraCategories.h
project_files/HedgewarsMobile/Classes/ExtraCategories.m
project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m
project_files/HedgewarsMobile/Classes/MainMenuViewController-iPad.xib
project_files/HedgewarsMobile/Classes/MainMenuViewController.m
project_files/HedgewarsMobile/Classes/ObjcExports.m
project_files/HedgewarsMobile/Classes/OverlayViewController.m
--- a/project_files/HedgewarsMobile/Classes/ExtraCategories.h	Mon Jan 30 07:51:30 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/ExtraCategories.h	Mon Jan 30 23:20:28 2012 +0100
@@ -25,6 +25,7 @@
 @interface UIScreen (safe)
 
 -(CGFloat) safeScale;
+-(CGRect) safeBounds;
 
 @end
 
--- a/project_files/HedgewarsMobile/Classes/ExtraCategories.m	Mon Jan 30 07:51:30 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/ExtraCategories.m	Mon Jan 30 23:20:28 2012 +0100
@@ -34,6 +34,16 @@
     return theScale;
 }
 
+-(CGRect) safeBounds {
+    CGRect original = [self bounds];
+    if (IS_IPAD() &&
+        ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortrait ||
+         [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown) ) {
+        return original;
+    } else
+        return CGRectMake(original.origin.x, original.origin.y, original.size.height, original.size.width);
+}
+
 @end
 
 
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Mon Jan 30 07:51:30 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Mon Jan 30 23:20:28 2012 +0100
@@ -128,15 +128,9 @@
         width = screenBounds.size.width;
         height = screenBounds.size.height;
     } else {
-        CGRect screenBounds = [[UIScreen mainScreen] bounds];
-        UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
-        if ((orientation == UIInterfaceOrientationLandscapeLeft) || (orientation == UIInterfaceOrientationLandscapeRight)) {
-            width = screenBounds.size.height;
-            height = screenBounds.size.width;
-        } else {
-            width = screenBounds.size.width;
-            height = screenBounds.size.height;
-        }
+        CGRect screenBounds = [[UIScreen mainScreen] safeBounds];
+        width = screenBounds.size.width;
+        height = screenBounds.size.height;
     }
 
     NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", (int)(width * screenScale)];
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController-iPad.xib	Mon Jan 30 07:51:30 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController-iPad.xib	Mon Jan 30 23:20:28 2012 +0100
@@ -39,7 +39,7 @@
 			</object>
 			<object class="IBUIView" id="191373211">
 				<reference key="NSNextResponder"/>
-				<int key="NSvFlags">292</int>
+				<int key="NSvFlags">294</int>
 				<object class="NSMutableArray" key="NSSubviews">
 					<bool key="EncodedWithXMLCoder">YES</bool>
 					<object class="IBUIImageView" id="976741091">
@@ -56,8 +56,8 @@
 					</object>
 					<object class="IBUIButton" id="867308721">
 						<reference key="NSNextResponder" ref="191373211"/>
-						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{383, 389}, {263, 244}}</string>
+						<int key="NSvFlags">301</int>
+						<string key="NSFrame">{{383, 389}, {271, 244}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
 						<string key="targetRuntimeIdentifier">IBIPadFramework</string>
@@ -91,10 +91,10 @@
 					</object>
 					<object class="IBUIButton" id="95106947">
 						<reference key="NSNextResponder" ref="191373211"/>
-						<int key="NSvFlags">292</int>
-						<string key="NSFrame">{{795, 317}, {18, 19}}</string>
+						<int key="NSvFlags">289</int>
+						<string key="NSFrame">{{986, 19}, {18, 19}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
-						<bool key="IBUIOpaque">NO</bool>
+						<bool key="IBUIClipsSubviews">YES</bool>
 						<float key="IBUIAlpha">0.31690141558647156</float>
 						<int key="IBUITag">3</int>
 						<string key="targetRuntimeIdentifier">IBIPadFramework</string>
@@ -112,7 +112,7 @@
 					</object>
 					<object class="IBUIButton" id="898948205">
 						<reference key="NSNextResponder" ref="191373211"/>
-						<int key="NSvFlags">292</int>
+						<int key="NSvFlags">265</int>
 						<string key="NSFrame">{{940, 686}, {64, 64}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
@@ -134,7 +134,7 @@
 					</object>
 					<object class="IBUIButton" id="894101036">
 						<reference key="NSNextResponder" ref="191373211"/>
-						<int key="NSvFlags">292</int>
+						<int key="NSvFlags">268</int>
 						<string key="NSFrame">{{20, 686}, {64, 64}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
@@ -156,7 +156,7 @@
 					</object>
 					<object class="IBUIImageView" id="1019880682">
 						<reference key="NSNextResponder" ref="191373211"/>
-						<int key="NSvFlags">292</int>
+						<int key="NSvFlags">301</int>
 						<string key="NSFrame">{{242, 43}, {540, 300}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIUserInteractionEnabled">NO</bool>
@@ -168,7 +168,7 @@
 					</object>
 					<object class="IBUIButton" id="357438048">
 						<reference key="NSNextResponder" ref="191373211"/>
-						<int key="NSvFlags">292</int>
+						<int key="NSvFlags">269</int>
 						<string key="NSFrame">{{468, 686}, {89, 37}}</string>
 						<reference key="NSSuperview" ref="191373211"/>
 						<bool key="IBUIOpaque">NO</bool>
@@ -272,11 +272,11 @@
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<reference ref="976741091"/>
 							<reference ref="867308721"/>
-							<reference ref="95106947"/>
 							<reference ref="898948205"/>
 							<reference ref="894101036"/>
 							<reference ref="1019880682"/>
 							<reference ref="357438048"/>
+							<reference ref="95106947"/>
 						</object>
 						<reference key="parent" ref="0"/>
 					</object>
@@ -354,13 +354,13 @@
 					<bool key="EncodedWithXMLCoder">YES</bool>
 					<string>MainMenuViewController</string>
 					<string>UIResponder</string>
-					<string>{{267, 388}, {1024, 768}}</string>
+					<string>{{89, 260}, {1024, 768}}</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<object class="NSAffineTransform">
-						<bytes key="NSTransformStruct">P4AAAL+AAABERQAAw56AAA</bytes>
+						<bytes key="NSTransformStruct">P4AAAL+AAABERsAAw6cAAA</bytes>
 					</object>
 					<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
 					<object class="NSAffineTransform">
--- a/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Mon Jan 30 07:51:30 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/MainMenuViewController.m	Mon Jan 30 23:20:28 2012 +0100
@@ -91,6 +91,7 @@
 
 #pragma mark -
 -(void) viewDidLoad {
+    self.view.frame = [[UIScreen mainScreen] safeBounds];
     [super viewDidLoad];
 
     // get the app's version
--- a/project_files/HedgewarsMobile/Classes/ObjcExports.m	Mon Jan 30 07:51:30 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/ObjcExports.m	Mon Jan 30 23:20:28 2012 +0100
@@ -69,6 +69,10 @@
     overlay_instance.loadingIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
     overlay_instance.loadingIndicator.hidesWhenStopped = YES;
     overlay_instance.loadingIndicator.center = loaderCenter;
+    overlay_instance.loadingIndicator.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |
+                                                         UIViewAutoresizingFlexibleRightMargin |
+                                                         UIViewAutoresizingFlexibleTopMargin |
+                                                         UIViewAutoresizingFlexibleBottomMargin;
     [overlay_instance.loadingIndicator startAnimating];
     [overlay_instance.view addSubview:overlay_instance.loadingIndicator];
     [overlay_instance.loadingIndicator release];
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Mon Jan 30 07:51:30 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Mon Jan 30 23:20:28 2012 +0100
@@ -65,13 +65,7 @@
 
 -(void) viewDidLoad {
     // fill all the screen available as sdlview disables autoresizing
-    CGRect rect = [[UIScreen mainScreen] bounds];
-    UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
-    if ((orientation == UIInterfaceOrientationLandscapeLeft) || (orientation == UIInterfaceOrientationLandscapeRight)) {
-        self.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width);
-    } else {
-        self.view.frame = CGRectMake(0, 0, rect.size.width, rect.size.height);
-    }
+    self.view.frame = [[UIScreen mainScreen] safeBounds];
     // the timer used to dim the overlay
     dimTimer = [[NSTimer alloc] initWithFireDate:(IS_DUALHEAD()) ? HIDING_TIME_NEVER : [NSDate dateWithTimeIntervalSinceNow:6]
                                         interval:1000