Setup Godot to support the Oculus Mobile SDK.

This commit is contained in:
fhuya 2019-05-30 12:50:36 -07:00
parent a2cf1c3d04
commit 2c3536810a
18 changed files with 1336 additions and 667 deletions

View file

@ -60,6 +60,8 @@ GodotJavaWrapper::GodotJavaWrapper(JNIEnv *p_env, jobject p_godot_instance) {
_set_clipboard = p_env->GetMethodID(cls, "setClipboard", "(Ljava/lang/String;)V");
_request_permission = p_env->GetMethodID(cls, "requestPermission", "(Ljava/lang/String;)Z");
_init_input_devices = p_env->GetMethodID(cls, "initInputDevices", "()V");
_get_surface = p_env->GetMethodID(cls, "getSurface", "()Landroid/view/Surface;");
_is_activity_resumed = p_env->GetMethodID(cls, "isActivityResumed", "()Z");
}
GodotJavaWrapper::~GodotJavaWrapper() {
@ -191,3 +193,21 @@ void GodotJavaWrapper::init_input_devices() {
env->CallVoidMethod(godot_instance, _init_input_devices);
}
}
jobject GodotJavaWrapper::get_surface() {
if (_get_surface) {
JNIEnv *env = ThreadAndroid::get_env();
return env->CallObjectMethod(godot_instance, _get_surface);
} else {
return NULL;
}
}
bool GodotJavaWrapper::is_activity_resumed() {
if (_is_activity_resumed) {
JNIEnv *env = ThreadAndroid::get_env();
return env->CallBooleanMethod(godot_instance, _is_activity_resumed);
} else {
return false;
}
}