From d78051c92c568fa8a36b44d565955f3088069cf8 Mon Sep 17 00:00:00 2001 From: Zach Coleman Date: Wed, 12 Oct 2022 15:17:36 -0400 Subject: [PATCH] Add iOS UI Options --- doc/classes/ProjectSettings.xml | 7 +++++++ main/main.cpp | 2 ++ platform/ios/view_controller.mm | 12 ++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 4b2bb3b6e91..0dc24345e93 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -565,6 +565,13 @@ If [code]true[/code], the home indicator is hidden automatically. This only affects iOS devices without a physical home button. + + If [code]true[/code], the status bar is hidden while the app is running. + + + If [code]true[/code], it will require two swipes to access iOS UI that uses gestures. + [b]Note:[/b] This setting has no effect on the home indicator if [code]hide_home_indicator[/code] is [code]true[/code]. + If [code]true[/code], allows per-pixel transparency for the window background. This affects performance, so leave it on [code]false[/code] unless you need it. See also [member display/window/size/transparent] and [member rendering/transparent_background]. diff --git a/main/main.cpp b/main/main.cpp index 08a9b4c310c..0f73bc7d1e3 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1808,6 +1808,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph "0,33200,1,or_greater")); // No negative numbers GLOBAL_DEF("display/window/ios/hide_home_indicator", true); + GLOBAL_DEF("display/window/ios/hide_status_bar", true); + GLOBAL_DEF("display/window/ios/suppress_ui_gesture", true); GLOBAL_DEF("input_devices/pointing/ios/touch_delay", 0.15); ProjectSettings::get_singleton()->set_custom_property_info("input_devices/pointing/ios/touch_delay", PropertyInfo(Variant::FLOAT, diff --git a/platform/ios/view_controller.mm b/platform/ios/view_controller.mm index 43669d3f94e..53c5d3d0b44 100644 --- a/platform/ios/view_controller.mm +++ b/platform/ios/view_controller.mm @@ -164,7 +164,11 @@ // MARK: Orientation - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures { - return UIRectEdgeAll; + if (GLOBAL_GET("display/window/ios/suppress_ui_gesture")) { + return UIRectEdgeAll; + } else { + return UIRectEdgeNone; + } } - (BOOL)shouldAutorotate { @@ -206,7 +210,11 @@ } - (BOOL)prefersStatusBarHidden { - return YES; + if (GLOBAL_GET("display/window/ios/hide_status_bar")) { + return YES; + } else { + return NO; + } } - (BOOL)prefersHomeIndicatorAutoHidden {