Created
July 16, 2020 20:58
-
-
Save MrCrambo/7d76fc62dc9e76b41d7943c0a19b9ee3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JNIEXPORT void JNICALL | |
Java_com_navigine_view_internal_GLRenderer_onEventHandled(JNIEnv * env, jobject self, jobject motionEvent) | |
{ | |
// getting motion event class | |
jclass motionEventClass=env->GetObjectClass(motionEvent); | |
// getting functions id | |
jmethodID pointersCountMethodId = env->GetMethodID(motionEventClass, "getPointerCount", "()I"); | |
jmethodID pointerIndexMethodId = env->GetMethodID(motionEventClass, "findPointerIndex", "(I)I"); | |
jmethodID getActionMethodId = env->GetMethodID(motionEventClass, "getActionMasked", "()I"); | |
jmethodID getXMethodId = env->GetMethodID(motionEventClass, "getX", "(I)F"); | |
jmethodID getYMethodId = env->GetMethodID(motionEventClass, "getY", "(I)F"); | |
int pointersCount = env->CallIntMethod(motionEvent, pointersCountMethodId); | |
int pointerIndexFirst = env->CallIntMethod(motionEvent, pointerIndexMethodId, 0); | |
int pointerIndexSecond = env->CallIntMethod(motionEvent, pointerIndexMethodId, 1); | |
int action = env->CallIntMethod(motionEvent, getActionMethodId); | |
// .. | |
// do something with this | |
// .. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment