starting to convert the ipad interface to support all ortientations...
authorkoda
Sun, 29 Jan 2012 02:48:03 +0100
changeset 6612 8fd6bb239a1e
parent 6611 d9d00e537010
child 6613 c7bf3b7c49dd
starting to convert the ipad interface to support all ortientations...
project_files/HedgewarsMobile/Classes/DefinesAndMacros.h
project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m
project_files/HedgewarsMobile/Classes/OverlayViewController.m
project_files/HedgewarsMobile/Info.plist
--- a/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h	Sun Jan 29 02:45:12 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/DefinesAndMacros.h	Sun Jan 29 02:48:03 2012 +0100
@@ -38,7 +38,7 @@
 
 
 #define ZAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0)
-#define rotationManager(x) (x == UIInterfaceOrientationLandscapeRight) || (x == UIInterfaceOrientationLandscapeLeft)
+#define rotationManager(x) (IS_IPAD() ? YES : (x == UIInterfaceOrientationLandscapeRight) || (x == UIInterfaceOrientationLandscapeLeft))
 
 #define START_TIMER NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate];
 #define END_TIMER(msg) 	NSTimeInterval stop = [NSDate timeIntervalSinceReferenceDate]; CMLog([NSString stringWithFormat:@"%@ Time = %f", msg, stop-start]);
--- a/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Sun Jan 29 02:45:12 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/GameInterfaceBridge.m	Sun Jan 29 02:48:03 2012 +0100
@@ -129,8 +129,14 @@
         height = screenBounds.size.height;
     } else {
         CGRect screenBounds = [[UIScreen mainScreen] bounds];
-        width = screenBounds.size.height;
-        height = screenBounds.size.width;
+        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;
+        }
     }
 
     NSString *horizontalSize = [[NSString alloc] initWithFormat:@"%d", (int)(width * screenScale)];
--- a/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Sun Jan 29 02:45:12 2012 +0100
+++ b/project_files/HedgewarsMobile/Classes/OverlayViewController.m	Sun Jan 29 02:48:03 2012 +0100
@@ -66,8 +66,12 @@
 -(void) viewDidLoad {
     // fill all the screen available as sdlview disables autoresizing
     CGRect rect = [[UIScreen mainScreen] bounds];
-    self.view.frame = CGRectMake(0, 0, rect.size.height, rect.size.width);
-
+    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);
+    }
     // the timer used to dim the overlay
     dimTimer = [[NSTimer alloc] initWithFireDate:(IS_DUALHEAD()) ? HIDING_TIME_NEVER : [NSDate dateWithTimeIntervalSinceNow:6]
                                         interval:1000
--- a/project_files/HedgewarsMobile/Info.plist	Sun Jan 29 02:45:12 2012 +0100
+++ b/project_files/HedgewarsMobile/Info.plist	Sun Jan 29 02:48:03 2012 +0100
@@ -37,10 +37,17 @@
 	<true/>
 	<key>UILaunchImageFile~ipad</key>
 	<string>Default-ipad</string>
-	<key>UISupportedInterfaceOrientations</key>
+	<key>UISupportedInterfaceOrientations~iphone</key>
 	<array>
 		<string>UIInterfaceOrientationLandscapeLeft</string>
 		<string>UIInterfaceOrientationLandscapeRight</string>
 	</array>
+	<key>UISupportedInterfaceOrientations~ipad</key>
+	<array>
+		<string>UIInterfaceOrientationPortrait</string>
+		<string>UIInterfaceOrientationPortraitUpsideDown</string>
+		<string>UIInterfaceOrientationLandscapeLeft</string>
+		<string>UIInterfaceOrientationLandscapeRight</string>
+	</array>
 </dict>
 </plist>