summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-05-21 21:29:24 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2021-05-24 18:53:10 +0200
commit660952a85773e959664376faf5c09e63aa613092 (patch)
tree0140da00d0fe0c373767841cb4fefb6e934a1054 /platform/android
parent2362a59a110e339e402c32dc844fd85e84f2a18d (diff)
Use an enum to represent screen orientation in the Project Settings
- Tweak the setting property hint to be more informative. - Make the setting a "basic" setting so it appears when Advanced Settings is disabled. - Remove redundant orientation setting in the iOS export preset. The project setting is now used (like on Android). Projects upgrading from a previous version will have to set the screen orientation again in the Project Settings if it wasn't set to the default value ("landscape").
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/export/export.cpp3
-rw-r--r--platform/android/export/gradle_export_util.h24
2 files changed, 3 insertions, 24 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index cd3f00f935..ec2618a3d5 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -847,7 +847,8 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
int version_code = p_preset->get("version/code");
String package_name = p_preset->get("package/unique_name");
- const int screen_orientation = _get_android_orientation_value(_get_screen_orientation());
+ const int screen_orientation =
+ _get_android_orientation_value(DisplayServer::ScreenOrientation(int(GLOBAL_GET("display/window/handheld/orientation"))));
bool screen_support_small = p_preset->get("screen/support_small");
bool screen_support_normal = p_preset->get("screen/support_normal");
diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h
index bbbb526af9..48e7fd46ac 100644
--- a/platform/android/export/gradle_export_util.h
+++ b/platform/android/export/gradle_export_util.h
@@ -44,28 +44,6 @@ const String godot_project_name_xml_string = R"(<?xml version="1.0" encoding="ut
</resources>
)";
-DisplayServer::ScreenOrientation _get_screen_orientation() {
- String orientation_settings = ProjectSettings::get_singleton()->get("display/window/handheld/orientation");
- DisplayServer::ScreenOrientation screen_orientation;
- if (orientation_settings == "portrait") {
- screen_orientation = DisplayServer::SCREEN_PORTRAIT;
- } else if (orientation_settings == "reverse_landscape") {
- screen_orientation = DisplayServer::SCREEN_REVERSE_LANDSCAPE;
- } else if (orientation_settings == "reverse_portrait") {
- screen_orientation = DisplayServer::SCREEN_REVERSE_PORTRAIT;
- } else if (orientation_settings == "sensor_landscape") {
- screen_orientation = DisplayServer::SCREEN_SENSOR_LANDSCAPE;
- } else if (orientation_settings == "sensor_portrait") {
- screen_orientation = DisplayServer::SCREEN_SENSOR_PORTRAIT;
- } else if (orientation_settings == "sensor") {
- screen_orientation = DisplayServer::SCREEN_SENSOR;
- } else {
- screen_orientation = DisplayServer::SCREEN_LANDSCAPE;
- }
-
- return screen_orientation;
-}
-
int _get_android_orientation_value(DisplayServer::ScreenOrientation screen_orientation) {
switch (screen_orientation) {
case DisplayServer::SCREEN_PORTRAIT:
@@ -266,7 +244,7 @@ String _get_instrumentation_tag(const Ref<EditorExportPreset> &p_preset) {
String _get_activity_tag(const Ref<EditorExportPreset> &p_preset) {
bool uses_xr = (int)(p_preset->get("xr_features/xr_mode")) == 1;
- String orientation = _get_android_orientation_label(_get_screen_orientation());
+ String orientation = _get_android_orientation_label(DisplayServer::ScreenOrientation(int(GLOBAL_GET("display/window/handheld/orientation"))));
String manifest_activity_text = vformat(
" <activity android:name=\"com.godot.game.GodotApp\" "
"tools:replace=\"android:screenOrientation\" "