cocos2d / cocos2d-x-3rd-party-libs-src

Dependencies of cocos2d-x.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

handleTouchesMove error for Android arm64

Gloudas opened this issue · comments

I have used this project to build 64bit versions of the cocos 3rd party libraries. However, when I then try to build my project with ABI := arm64-v8a on a Mac running Yosemite with NDK r10c, I get the following errors pasted below. These are only present when building for arm64-v8a, armeabi still builds correctly. Any help understanding/fixing these errors would be very helpful.

jni/../../../3rd-party/cocos2d-x/cocos/platform/android/../../platform/CCGLViewProtocol.h:165:18: note: no known conversion for argument 2 from 'jint* {aka int_}' to 'intptr_t_ {aka long int_}'
jni/../../../3rd-party/cocos2d-x/cocos/platform/android/jni/TouchesJni.cpp: In function 'void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove(JNIEnv_, jobject, jintArray, jfloatArray, jfloatArray)':
jni/../../../3rd-party/cocos2d-x/cocos/platform/android/jni/TouchesJni.cpp:52:92: error: no matching function for call to 'cocos2d::GLView::handleTouchesMove(int&, jint [size], jfloat [size], jfloat [size])'
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesMove(size, id, x, y);
^
jni/../../../3rd-party/cocos2d-x/cocos/platform/android/jni/TouchesJni.cpp:52:92: note: candidate is:
In file included from jni/../../../3rd-party/cocos2d-x/cocos/platform/android/CCGLView.h:34:0,
from jni/../../../3rd-party/cocos2d-x/cocos/platform/android/jni/TouchesJni.cpp:26:
jni/../../../3rd-party/cocos2d-x/cocos/platform/android/../../platform/CCGLViewProtocol.h:164:18: note: virtual void cocos2d::GLViewProtocol::handleTouchesMove(int, intptr_t_, float_, float_)
virtual void handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[]);
^
jni/../../../3rd-party/cocos2d-x/cocos/platform/android/../../platform/CCGLViewProtocol.h:164:18: note: no known conversion for argument 2 from 'jint [size] {aka int [size]}' to 'intptr_t_ {aka long int_}'
jni/../../../3rd-party/cocos2d-x/cocos/platform/android/jni/TouchesJni.cpp: In function 'void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel(JNIEnv_, jobject, jintArray, jfloatArray, jfloatArray)':
jni/../../../3rd-party/cocos2d-x/cocos/platform/android/jni/TouchesJni.cpp:65:94: error: no matching function for call to 'cocos2d::GLView::handleTouchesCancel(int&, jint [size], jfloat [size], jfloat [size])'
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesCancel(size, id, x, y);
^
jni/../../../3rd-party/cocos2d-x/cocos/platform/android/jni/TouchesJni.cpp:65:94: note: candidate is:
In file included from jni/../../../3rd-party/cocos2d-x/cocos/platform/android/CCGLView.h:34:0,
from jni/../../../3rd-party/cocos2d-x/cocos/platform/android/jni/TouchesJni.cpp:26:
jni/../../../3rd-party/cocos2d-x/cocos/platform/android/../../platform/CCGLViewProtocol.h:166:18: note: virtual void cocos2d::GLViewProtocol::handleTouchesCancel(int, intptr_t_, float_, float_)
virtual void handleTouchesCancel(int num, intptr_t ids[], float xs[], float ys[]);
^
jni/../../../3rd-party/cocos2d-x/cocos/platform/android/../../platform/CCGLViewProtocol.h:166:18: note: no known conversion for argument 2 from 'jint [size] {aka int [size]}' to 'intptr_t_ {aka long int_}'
make: *_* [obj/local/arm64-v8a/objs-debug/cocos2dxandroid_static/jni/TouchesJni.o] Error 1

@Gloudas
hmmm.. wired, but I think it should be OK with Arm64-v8a

@Gloudas Have you resolved this issue ?

I think you should modify like this

JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) {
    int size = env->GetArrayLength(ids);
    jin id[size];
    jfloat x[size];
    jfloat y[size];

    env->GetIntArrayRegion(ids, 0, size, id);
    env->GetFloatArrayRegion(xs, 0, size, x);
    env->GetFloatArrayRegion(ys, 0, size, y);


    intptr_t idlong[size];// convert !
    for(int i = 0; i < size; i++)
        idlong[i] = id[i];

    cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesCancel(size, idlong, x, y);
}