mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
Update the editor display scale based on the device's scaled density
This commit is contained in:
parent
10d9e47949
commit
8eabf77f54
8 changed files with 44 additions and 2 deletions
|
@ -54,6 +54,7 @@ GodotIOJavaWrapper::GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instanc
|
|||
_get_locale = p_env->GetMethodID(cls, "getLocale", "()Ljava/lang/String;");
|
||||
_get_model = p_env->GetMethodID(cls, "getModel", "()Ljava/lang/String;");
|
||||
_get_screen_DPI = p_env->GetMethodID(cls, "getScreenDPI", "()I");
|
||||
_get_scaled_density = p_env->GetMethodID(cls, "getScaledDensity", "()F");
|
||||
_get_screen_refresh_rate = p_env->GetMethodID(cls, "getScreenRefreshRate", "(D)D");
|
||||
_screen_get_usable_rect = p_env->GetMethodID(cls, "screenGetUsableRect", "()[I"),
|
||||
_get_unique_id = p_env->GetMethodID(cls, "getUniqueID", "()Ljava/lang/String;");
|
||||
|
@ -138,6 +139,16 @@ int GodotIOJavaWrapper::get_screen_dpi() {
|
|||
}
|
||||
}
|
||||
|
||||
float GodotIOJavaWrapper::get_scaled_density() {
|
||||
if (_get_scaled_density) {
|
||||
JNIEnv *env = get_jni_env();
|
||||
ERR_FAIL_COND_V(env == nullptr, 1.0f);
|
||||
return env->CallFloatMethod(godot_io_instance, _get_scaled_density);
|
||||
} else {
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
float GodotIOJavaWrapper::get_screen_refresh_rate(float fallback) {
|
||||
if (_get_screen_refresh_rate) {
|
||||
JNIEnv *env = get_jni_env();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue