Merge pull request #9090 from wangqm0513/patch-1

Update TouchesJni.cpp
This commit is contained in:
minggo 2014-11-13 15:22:35 +08:00
commit c64ee1b4b8
1 changed files with 14 additions and 4 deletions

View File

@ -33,11 +33,13 @@ using namespace cocos2d;
extern "C" {
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesBegin(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) {
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesBegin(1, &id, &x, &y);
intptr_t idlong = id;
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesBegin(1, &idlong, &x, &y);
}
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesEnd(JNIEnv * env, jobject thiz, jint id, jfloat x, jfloat y) {
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesEnd(1, &id, &x, &y);
intptr_t idlong = id;
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesEnd(1, &idlong, &x, &y);
}
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesMove(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) {
@ -50,7 +52,11 @@ extern "C" {
env->GetFloatArrayRegion(xs, 0, size, x);
env->GetFloatArrayRegion(ys, 0, size, y);
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesMove(size, id, x, y);
intptr_t idlong[size];
for(int i = 0; i < size; i++)
idlong[i] = id[i];
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesMove(size, idlong, x, y);
}
JNIEXPORT void JNICALL Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeTouchesCancel(JNIEnv * env, jobject thiz, jintArray ids, jfloatArray xs, jfloatArray ys) {
@ -63,7 +69,11 @@ extern "C" {
env->GetFloatArrayRegion(xs, 0, size, x);
env->GetFloatArrayRegion(ys, 0, size, y);
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesCancel(size, id, x, y);
intptr_t idlong[size];
for(int i = 0; i < size; i++)
idlong[i] = id[i];
cocos2d::Director::getInstance()->getOpenGLView()->handleTouchesCancel(size, idlong, x, y);
}
#define KEYCODE_BACK 0x04