iOS portrait mode support

This commit is contained in:
Anuken 2018-08-16 18:38:43 -04:00
parent 53d35e8c77
commit 6d7941fba4
2 changed files with 127 additions and 109 deletions

View File

@ -1,118 +1,119 @@
<?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>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${app.name}</string>
<key>CFBundleExecutable</key>
<string>${app.executable}</string>
<key>CFBundleIdentifier</key>
<string>${app.id}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>MinimumOSVersion</key>
<string>9.0.0</string>
<key>CFBundleName</key>
<string>${app.name}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${app.version}</string>
<key>CFBundleIconName</key>
<string>AppIcon</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${app.build}</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIStatusBarHidden</key>
<true/>
<key>UIRequiresFullScreen</key>
<true/>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Mindustry</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
<string>opengles-2</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${app.name}</string>
<key>CFBundleExecutable</key>
<string>${app.executable}</string>
<key>CFBundleIdentifier</key>
<string>${app.id}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>MinimumOSVersion</key>
<string>9.0.0</string>
<key>CFBundleName</key>
<string>${app.name}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${app.version}</string>
<key>CFBundleIconName</key>
<string>AppIcon</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${app.build}</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIStatusBarHidden</key>
<true/>
<key>UIRequiresFullScreen</key>
<true/>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Mindustry</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
<string>opengles-2</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>icon-72.png</string>
</array>
<key>CFBundleTypeName</key>
<string>Mindustry Map File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>io.anuke.mindustry.mapfile</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFiles</key>
<array>
<string>icon-72.png</string>
</array>
<key>CFBundleTypeName</key>
<string>Mindustry Map File</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>io.anuke.mindustry.mapfile</string>
<string>io.anuke.mindustry.savefile</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Mindustry Save File</string>
<key>UTTypeIdentifier</key>
<string>io.anuke.mindustry.savefile</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Mindustry Save File</string>
<key>UTTypeIdentifier</key>
<string>io.anuke.mindustry.savefile</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>msav</string>
<key>public.mime-type</key>
<string>mindustry/msav</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>msav</string>
<key>public.mime-type</key>
<string>mindustry/msav</string>
</dict>
</dict>
</dict>
</array>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Mindustry Map File</string>
<key>UTTypeIdentifier</key>
<string>io.anuke.mindustry.mapfile</string>
<key>UTTypeTagSpecification</key>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>public.filename-extension</key>
<string>mmap</string>
<key>public.mime-type</key>
<string>mindustry/mmap</string>
<key>UTTypeConformsTo</key>
<array>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Mindustry Map File</string>
<key>UTTypeIdentifier</key>
<string>io.anuke.mindustry.mapfile</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<string>mmap</string>
<key>public.mime-type</key>
<string>mindustry/mmap</string>
</dict>
</dict>
</dict>
</array>
</dict>
</array>
</dict>
</plist>

View File

@ -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());