Created
August 10, 2012 22:04
-
-
Save michaelcontento/3318515 to your computer and use it in GitHub Desktop.
Monkey: IOS_SCREEN_ORIENTATION patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git src/trans/targets/ios.monkey src/trans/targets/ios.monkey | |
index e44b1c7..e434fbf 100755 | |
--- src/trans/targets/ios.monkey | |
+++ src/trans/targets/ios.monkey | |
@@ -24,6 +24,26 @@ Class IosTarget Extends Target | |
Next | |
Return config.Join( "~n" ) | |
End | |
+ | |
+ Method ReplaceIosScreenOrientation() | |
+ Local plist$=LoadString ( "MonkeyGame-Info.plist" ) | |
+ Local orientation$=Env.Get("IOS_SCREEN_ORIENTATION") | |
+ | |
+ If plist.Find("IOS_SCREEN_ORIENTATION_") = -1 Then Return | |
+ | |
+ If orientation = "portrait" | |
+ plist=ReplaceBlock( plist,"IOS_SCREEN_ORIENTATION_LANDSCAPE","","~n<!--" ) | |
+ ElseIf orientation = "landscape" | |
+ plist=ReplaceBlock( plist,"IOS_SCREEN_ORIENTATION_PORTRAIT","","~n<!--" ) | |
+ ElseIf orientation = "all" | |
+ ' Return early to skip the useless SaveString | |
+ Return | |
+ Else | |
+ Die "Invalid IOS_SCREEN_ORIENTATION specified. Use one of: portrait, landscape, all" | |
+ End | |
+ | |
+ SaveString plist,"MonkeyGame-Info.plist" | |
+ End | |
Method MakeTarget() | |
@@ -36,6 +56,8 @@ Class IosTarget Extends Target | |
SaveString main,"main.mm" | |
+ ReplaceIosScreenOrientation() | |
+ | |
If OPT_ACTION>=ACTION_BUILD | |
Execute "xcodebuild -configuration "+CASED_CONFIG+" -sdk iphonesimulator" | |
diff --git targets/ios/CONFIG.TXT targets/ios/CONFIG.TXT | |
index ac26846..be820f5 100755 | |
--- targets/ios/CONFIG.TXT | |
+++ targets/ios/CONFIG.TXT | |
@@ -2,6 +2,7 @@ | |
IOS_RETINA_ENABLED=true | |
IOS_ACCELEROMETER_ENABLED=true | |
IOS_DISPLAY_LINK_ENABLED=false | |
+IOS_SCREEN_ORIENTATION=all | |
CPP_INCREMENTAL_GC=1 | |
diff --git targets/ios/MonkeyGame-Info.plist targets/ios/MonkeyGame-Info.plist | |
index e24e750..f4b90bb 100755 | |
--- targets/ios/MonkeyGame-Info.plist | |
+++ targets/ios/MonkeyGame-Info.plist | |
@@ -28,10 +28,14 @@ | |
<string>MainWindow</string> | |
<key>UISupportedInterfaceOrientations</key> | |
<array> | |
+<!--${IOS_SCREEN_ORIENTATION_PORTRAIT_BEGIN}--> | |
<string>UIInterfaceOrientationPortrait</string> | |
<string>UIInterfaceOrientationPortraitUpsideDown</string> | |
+<!--${IOS_SCREEN_ORIENTATION_PORTRAIT_END}--> | |
+<!--${IOS_SCREEN_ORIENTATION_LANDSCAPE_BEGIN}--> | |
<string>UIInterfaceOrientationLandscapeLeft</string> | |
<string>UIInterfaceOrientationLandscapeRight</string> | |
+<!--${IOS_SCREEN_ORIENTATION_LANDSCAPE_END}--> | |
</array> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to monkey v62