diff options
author | Fredia Huya-Kouadio <fhuyakou@gmail.com> | 2022-04-04 02:22:51 -0700 |
---|---|---|
committer | Fredia Huya-Kouadio <fhuyakou@gmail.com> | 2022-04-04 09:23:43 -0700 |
commit | 8eabf77f5403e7d7aff770f73a9b7906b424149a (patch) | |
tree | ed83fef086d1e03b9a4c999d8cc95258665deb52 /platform/android/java/lib/src | |
parent | 10d9e479491c25a350a8ed191987dd36ed43c073 (diff) |
Update the editor display scale based on the device's scaled density
Diffstat (limited to 'platform/android/java/lib/src')
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/GodotIO.java | 6 |
1 files changed, 5 insertions, 1 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 b151e7eec1..e8e292df5d 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java +++ b/platform/android/java/lib/src/org/godotengine/godot/GodotIO.java @@ -222,10 +222,14 @@ public class GodotIO { } public int getScreenDPI() { - DisplayMetrics metrics = activity.getApplicationContext().getResources().getDisplayMetrics(); + DisplayMetrics metrics = activity.getResources().getDisplayMetrics(); return (int)(metrics.density * 160f); } + public float getScaledDensity() { + return activity.getResources().getDisplayMetrics().scaledDensity; + } + public double getScreenRefreshRate(double fallback) { Display display = activity.getWindowManager().getDefaultDisplay(); if (display != null) { |