summaryrefslogtreecommitdiffstats
path: root/platform/android/java/lib
diff options
context:
space:
mode:
authorClay John <claynjohn@gmail.com>2024-10-29 12:34:40 -0700
committerGitHub <noreply@github.com>2024-10-29 12:34:40 -0700
commit748f4079e387fb555ee64c1619e94ba099bfa77a (patch)
treee296233766ae58d195f16c5e9f30191f7ba64ad8 /platform/android/java/lib
parent08f9cba0fbf27f171dea55de6f8274928b9f0d84 (diff)
parentaaa0e2fddfead4a31afddc07a26cd6af0c19dacd (diff)
downloadredot-engine-748f4079e387fb555ee64c1619e94ba099bfa77a.tar.gz
Merge pull request #96439 from darksylinc/matias-TheForge-pr03-rebased
Add Swappy & Pre-Transformed Swapchain
Diffstat (limited to 'platform/android/java/lib')
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/GodotIO.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
index f060c7aaff..5543745444 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
@@ -47,6 +47,7 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.DisplayCutout;
+import android.view.Surface;
import android.view.WindowInsets;
import androidx.core.content.FileProvider;
@@ -295,6 +296,28 @@ public class GodotIO {
}
}
+ /**
+ This function is used by DisplayServer::screen_get_internal_current_rotation (C++)
+ and is used to implement a performance optimization in devices that do not offer
+ a HW rotator.
+ @return
+ Rotation in degrees, in multiples of 90°
+ */
+ public int getInternalCurrentScreenRotation() {
+ int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
+
+ switch (rotation) {
+ case Surface.ROTATION_90:
+ return 90;
+ case Surface.ROTATION_180:
+ return 180;
+ case Surface.ROTATION_270:
+ return 270;
+ default:
+ return 0;
+ }
+ }
+
public void setEdit(GodotEditText _edit) {
edit = _edit;
}