iOS portrait mode support
This commit is contained in:
@@ -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());
|
||||
@@ -86,7 +88,17 @@ public class IOSLauncher extends IOSApplication.Delegate {
|
||||
p.getPopoverPresentationController().setSourceView(UIApplication.getSharedApplication().getKeyWindow().getRootViewController().getView());
|
||||
|
||||
UIApplication.getSharedApplication().getKeyWindow().getRootViewController()
|
||||
.presentViewController(p, true, () -> io.anuke.ucore.util.Log.info("Success! Presented {0}", to));
|
||||
.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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -94,6 +106,11 @@ public class IOSLauncher extends IOSApplication.Delegate {
|
||||
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