mirror of
https://github.com/godotengine/godot.git
synced 2025-11-02 14:41:07 +00:00
Support dark mode on Android and iOS.
This commit is contained in:
parent
c12d63556b
commit
428eb1309a
8 changed files with 84 additions and 2 deletions
|
|
@ -62,6 +62,8 @@ GodotJavaWrapper::GodotJavaWrapper(JNIEnv *p_env, jobject p_activity, jobject p_
|
|||
_finish = p_env->GetMethodID(godot_class, "forceQuit", "(I)Z");
|
||||
_set_keep_screen_on = p_env->GetMethodID(godot_class, "setKeepScreenOn", "(Z)V");
|
||||
_alert = p_env->GetMethodID(godot_class, "alert", "(Ljava/lang/String;Ljava/lang/String;)V");
|
||||
_is_dark_mode_supported = p_env->GetMethodID(godot_class, "isDarkModeSupported", "()Z");
|
||||
_is_dark_mode = p_env->GetMethodID(godot_class, "isDarkMode", "()Z");
|
||||
_get_clipboard = p_env->GetMethodID(godot_class, "getClipboard", "()Ljava/lang/String;");
|
||||
_set_clipboard = p_env->GetMethodID(godot_class, "setClipboard", "(Ljava/lang/String;)V");
|
||||
_has_clipboard = p_env->GetMethodID(godot_class, "hasClipboard", "()Z");
|
||||
|
|
@ -172,6 +174,26 @@ void GodotJavaWrapper::alert(const String &p_message, const String &p_title) {
|
|||
}
|
||||
}
|
||||
|
||||
bool GodotJavaWrapper::is_dark_mode_supported() {
|
||||
if (_is_dark_mode_supported) {
|
||||
JNIEnv *env = get_jni_env();
|
||||
ERR_FAIL_NULL_V(env, false);
|
||||
return env->CallBooleanMethod(godot_instance, _is_dark_mode_supported);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool GodotJavaWrapper::is_dark_mode() {
|
||||
if (_is_dark_mode) {
|
||||
JNIEnv *env = get_jni_env();
|
||||
ERR_FAIL_NULL_V(env, false);
|
||||
return env->CallBooleanMethod(godot_instance, _is_dark_mode);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool GodotJavaWrapper::has_get_clipboard() {
|
||||
return _get_clipboard != nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue