Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handleTouchesMove error for Android arm64 #25

Open
Gloudas opened this issue Dec 16, 2014 · 3 comments
Open

handleTouchesMove error for Android arm64 #25

Gloudas opened this issue Dec 16, 2014 · 3 comments

Comments

@Gloudas
Copy link

Gloudas commented Dec 16, 2014

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

@zilongshanren
Copy link
Member

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

@qgxqgx
Copy link

qgxqgx commented Sep 2, 2020

@Gloudas Have you resolved this issue ?

@qgxqgx
Copy link

qgxqgx commented Sep 2, 2020

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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants