diff options
author | Jamil Halabi <jay3dlinux@gmail.com> | 2016-07-15 15:31:34 +0800 |
---|---|---|
committer | Jamil Halabi <jay3dlinux@gmail.com> | 2016-07-16 01:43:32 +0800 |
commit | 370ae3512deda40b2659a1192f302298e269305f (patch) | |
tree | a1850f46fa1817be65981177326417fbdb33f5b0 /platform/android/java_glue.cpp | |
parent | 4c4ab140b4569f2700517a13b20127eb7542b3ec (diff) |
Added gyroscope support to Godot and Android
Diffstat (limited to 'platform/android/java_glue.cpp')
-rw-r--r-- | platform/android/java_glue.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 45d02876ba..b9d178280c 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -653,6 +653,7 @@ static bool quit_request=false; static Size2 new_size; static Vector3 accelerometer; static Vector3 magnetometer; +static Vector3 gyroscope; static HashMap<String,JNISingleton*> jni_singletons; static jobject godot_io; @@ -1093,6 +1094,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo os_android->process_magnetometer(magnetometer); + os_android->process_gyroscope(gyroscope); + if (os_android->main_loop_iterate()==true) { jclass cls = env->FindClass("org/godotengine/godot/Godot"); @@ -1501,6 +1504,14 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv * } +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gyroscope(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z) { + + input_mutex->lock(); + gyroscope=Vector3(x,y,z); + input_mutex->unlock(); + +} + JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv * env, jobject obj){ if (!suspend_mutex) |