From 5e7b0e3a61142b5c7d874ba5b1d710d497b4f821 Mon Sep 17 00:00:00 2001 From: Zach Coleman Date: Tue, 1 Nov 2022 21:08:13 -0400 Subject: [PATCH] [3.x] Add iOS UI Options --- doc/classes/ProjectSettings.xml | 7 +++++++ main/main.cpp | 2 ++ platform/iphone/view_controller.mm | 12 ++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index a763558056d..13d0d6ab566 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -483,6 +483,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 [member OS.window_per_pixel_transparency_enabled] for more details. diff --git a/main/main.cpp b/main/main.cpp index f241f7fe15d..3e94aeb180a 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1281,6 +1281,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } 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::REAL, diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm index 417f411c966..73f2063836a 100644 --- a/platform/iphone/view_controller.mm +++ b/platform/iphone/view_controller.mm @@ -168,7 +168,11 @@ // MARK: Orientation - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures { - return UIRectEdgeAll; + if (GLOBAL_GET("display/window/ios/suppress_ui_gesture")) { + return UIRectEdgeAll; + } else { + return UIRectEdgeNone; + } } - (BOOL)shouldAutorotate { @@ -210,7 +214,11 @@ } - (BOOL)prefersStatusBarHidden { - return YES; + if (GLOBAL_GET("display/window/ios/hide_status_bar")) { + return YES; + } else { + return NO; + } } - (BOOL)prefersHomeIndicatorAutoHidden {