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
+109 -108
View File
@@ -1,118 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>en</string> <string>en</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>${app.name}</string> <string>${app.name}</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>${app.executable}</string> <string>${app.executable}</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>${app.id}</string> <string>${app.id}</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>MinimumOSVersion</key> <key>MinimumOSVersion</key>
<string>9.0.0</string> <string>9.0.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>${app.name}</string> <string>${app.name}</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>${app.version}</string> <string>${app.version}</string>
<key>CFBundleIconName</key> <key>CFBundleIconName</key>
<string>AppIcon</string> <string>AppIcon</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>${app.build}</string> <string>${app.build}</string>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>UIStatusBarHidden</key> <key>UIStatusBarHidden</key>
<true/> <true/>
<key>UIRequiresFullScreen</key> <key>UIRequiresFullScreen</key>
<true/> <true/>
<key>NSPhotoLibraryAddUsageDescription</key> <key>NSPhotoLibraryAddUsageDescription</key>
<string>Mindustry</string> <string>Mindustry</string>
<key>UIDeviceFamily</key> <key>UIDeviceFamily</key>
<array> <array>
<integer>1</integer> <integer>1</integer>
<integer>2</integer> <integer>2</integer>
</array> </array>
<key>UIRequiredDeviceCapabilities</key> <key>UIRequiredDeviceCapabilities</key>
<array> <array>
<string>armv7</string> <string>armv7</string>
<string>opengles-2</string> <string>opengles-2</string>
</array> </array>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> <string>UIInterfaceOrientationPortrait</string>
</array>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict> <dict>
<key>CFBundleTypeIconFiles</key> <key>CFBundleTypeIconFiles</key>
<array> <array>
<string>icon-72.png</string> <string>icon-72.png</string>
</array> </array>
<key>CFBundleTypeName</key> <key>CFBundleTypeName</key>
<string>Mindustry Map File</string> <string>Mindustry Map File</string>
<key>CFBundleTypeRole</key> <key>CFBundleTypeRole</key>
<string>Editor</string> <string>Editor</string>
<key>LSHandlerRank</key> <key>LSHandlerRank</key>
<string>Owner</string> <string>Owner</string>
<key>LSItemContentTypes</key> <key>LSItemContentTypes</key>
<array> <array>
<string>io.anuke.mindustry.mapfile</string> <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> <string>io.anuke.mindustry.savefile</string>
</array> <key>UTTypeTagSpecification</key>
</dict> <dict>
</array> <key>public.filename-extension</key>
<string>msav</string>
<key>UTExportedTypeDeclarations</key> <key>public.mime-type</key>
<array> <string>mindustry/msav</string>
<dict> </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>
</dict> </dict>
</dict> </array>
</array>
<key>UTExportedTypeDeclarations</key> <key>UTExportedTypeDeclarations</key>
<array> <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>
<dict> <dict>
<key>public.filename-extension</key> <key>UTTypeConformsTo</key>
<string>mmap</string> <array>
<key>public.mime-type</key> <string>public.data</string>
<string>mindustry/mmap</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>
</dict> </array>
</array> </dict>
</dict>
</plist> </plist>
+18 -1
View File
@@ -32,6 +32,8 @@ import static io.anuke.mindustry.Vars.*;
import static org.robovm.apple.foundation.NSPathUtilities.getDocumentsDirectory; import static org.robovm.apple.foundation.NSPathUtilities.getDocumentsDirectory;
public class IOSLauncher extends IOSApplication.Delegate { public class IOSLauncher extends IOSApplication.Delegate {
private boolean forced;
@Override @Override
protected IOSApplication createApplication() { protected IOSApplication createApplication() {
Net.setClientProvider(new KryoClient()); Net.setClientProvider(new KryoClient());
@@ -86,7 +88,17 @@ public class IOSLauncher extends IOSApplication.Delegate {
p.getPopoverPresentationController().setSourceView(UIApplication.getSharedApplication().getKeyWindow().getRootViewController().getView()); p.getPopoverPresentationController().setSourceView(UIApplication.getSharedApplication().getKeyWindow().getRootViewController().getView());
UIApplication.getSharedApplication().getKeyWindow().getRootViewController() 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); return new IOSApplication(new Mindustry(), config);
} }
@Override
public UIInterfaceOrientationMask getSupportedInterfaceOrientations(UIApplication application, UIWindow window){
return forced ? UIInterfaceOrientationMask.Landscape : UIInterfaceOrientationMask.All;
}
@Override @Override
public boolean openURL(UIApplication app, NSURL url, UIApplicationOpenURLOptions options) { public boolean openURL(UIApplication app, NSURL url, UIApplicationOpenURLOptions options) {
System.out.println("Opened URL: " + url.getPath()); System.out.println("Opened URL: " + url.getPath());