From 8eabf77f5403e7d7aff770f73a9b7906b424149a Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Mon, 4 Apr 2022 02:22:51 -0700 Subject: Update the editor display scale based on the device's scaled density --- platform/android/java/lib/src/org/godotengine/godot/GodotIO.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'platform/android/java/lib/src/org') 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) { -- cgit v1.2.3