Add CameraFeed support for Android

Co-authored-by: KOGA Mitsuhiro <shiena.jp@gmail.com>
This commit is contained in:
Leo de Penning 2025-04-18 22:20:21 +09:00 committed by KOGA Mitsuhiro
parent 209a446e36
commit 296ca79b9d
12 changed files with 666 additions and 2 deletions

View file

@ -67,6 +67,7 @@ GodotIOJavaWrapper::GodotIOJavaWrapper(JNIEnv *p_env, jobject p_godot_io_instanc
_set_screen_orientation = p_env->GetMethodID(cls, "setScreenOrientation", "(I)V");
_get_screen_orientation = p_env->GetMethodID(cls, "getScreenOrientation", "()I");
_get_system_dir = p_env->GetMethodID(cls, "getSystemDir", "(IZ)Ljava/lang/String;");
_get_display_rotation = p_env->GetMethodID(cls, "getDisplayRotation", "()I");
}
}
@ -289,6 +290,16 @@ String GodotIOJavaWrapper::get_system_dir(int p_dir, bool p_shared_storage) {
}
}
int GodotIOJavaWrapper::get_display_rotation() {
if (_get_display_rotation) {
JNIEnv *env = get_jni_env();
ERR_FAIL_NULL_V(env, 0);
return env->CallIntMethod(godot_io_instance, _get_display_rotation);
} else {
return 0;
}
}
// SafeNumeric because it can be changed from non-main thread and we need to
// ensure the change is immediately visible to other threads.
static SafeNumeric<int> virtual_keyboard_height;