1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Update the editor display scale based on the device's scaled density

This commit is contained in:
Fredia Huya-Kouadio
2022-04-04 02:22:51 -07:00
parent a5f9e1ce18
commit 3ba0508f79
8 changed files with 46 additions and 2 deletions

View File

@@ -107,4 +107,18 @@ public class GodotEditor extends FullScreenGodotApp {
Intent newInstance = new Intent(this, targetClass).putExtra(COMMAND_LINE_PARAMS, args);
startActivity(newInstance);
}
@Override
public void setRequestedOrientation(int requestedOrientation) {
if (!overrideOrientationRequest()) {
super.setRequestedOrientation(requestedOrientation);
}
}
/**
* The Godot Android Editor sets its own orientation via its AndroidManifest
*/
protected boolean overrideOrientationRequest() {
return true;
}
}

View File

@@ -34,4 +34,7 @@ package org.godotengine.editor;
* Drives the 'run project' window of the Godot Editor.
*/
public class GodotGame extends GodotEditor {
protected boolean overrideOrientationRequest() {
return false;
}
}

View File

@@ -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) {