diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-05-29 18:37:33 +0200 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-05-29 18:37:33 +0200 |
commit | 96bdab6edfb2834a07add23cd3892a599ee9bfa4 (patch) | |
tree | 925f53859c34f0fe92f54a9901def5c8077359dd /platform/android/java_glue.cpp | |
parent | a2fee794591c09be9f1c625eee0df60977fb1e95 (diff) | |
parent | 8d69e1b6205b0f7073129873b2b8f809e6d25c2b (diff) |
Merge pull request #4845 from vnen/pr-magnetometer
Add magnetometer sensor support for 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 b5beb8fa2c..1ea7cd7ebb 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -650,6 +650,7 @@ static bool resized_reload=false; static bool quit_request=false; static Size2 new_size; static Vector3 accelerometer; +static Vector3 magnetometer; static HashMap<String,JNISingleton*> jni_singletons; static jobject godot_io; @@ -1088,6 +1089,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo os_android->process_accelerometer(accelerometer); + os_android->process_magnetometer(magnetometer); + if (os_android->main_loop_iterate()==true) { jclass cls = env->FindClass("org/godotengine/godot/Godot"); @@ -1488,6 +1491,14 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv } +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z) { + + input_mutex->lock(); + magnetometer=Vector3(x,y,z); + input_mutex->unlock(); + +} + JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv * env, jobject obj){ if (!suspend_mutex) |