iOS portrait mode support
This commit is contained in:
+3
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
@@ -50,6 +50,7 @@
|
||||
<array>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
@@ -114,5 +115,5 @@
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -32,6 +32,8 @@ import static io.anuke.mindustry.Vars.*;
|
||||
import static org.robovm.apple.foundation.NSPathUtilities.getDocumentsDirectory;
|
||||
|
||||
public class IOSLauncher extends IOSApplication.Delegate {
|
||||
private boolean forced;
|
||||
|
||||
@Override
|
||||
protected IOSApplication createApplication() {
|
||||
Net.setClientProvider(new KryoClient());
|
||||
@@ -88,12 +90,27 @@ public class IOSLauncher extends IOSApplication.Delegate {
|
||||
UIApplication.getSharedApplication().getKeyWindow().getRootViewController()
|
||||
.presentViewController(p, true, () -> io.anuke.ucore.util.Log.info("Success! Presented {0}", to));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginForceLandscape(){
|
||||
forced = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endForceLandscape(){
|
||||
forced = false;
|
||||
}
|
||||
};
|
||||
|
||||
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
|
||||
return new IOSApplication(new Mindustry(), config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UIInterfaceOrientationMask getSupportedInterfaceOrientations(UIApplication application, UIWindow window){
|
||||
return forced ? UIInterfaceOrientationMask.Landscape : UIInterfaceOrientationMask.All;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean openURL(UIApplication app, NSURL url, UIApplicationOpenURLOptions options) {
|
||||
System.out.println("Opened URL: " + url.getPath());
|
||||
|
||||
Reference in New Issue
Block a user