[DEBUG] correct android up and down for touch event

This commit is contained in:
Edouard DUPIN 2016-01-23 02:28:15 +01:00
parent 4dbd574790
commit 7a7c690a70
2 changed files with 34 additions and 34 deletions

View File

@ -87,12 +87,12 @@ public class GaleSurfaceViewGL extends GLSurfaceView implements GaleConstants {
m_galeNative.inputEventMotion(_event.getPointerId(p), (float)_event.getX(p), (float)_event.getY(p));
}
}
} else if( tmpActionType == MotionEvent.ACTION_POINTER_1_DOWN
|| tmpActionType == MotionEvent.ACTION_DOWN) {
} else if ( tmpActionType == MotionEvent.ACTION_POINTER_1_DOWN
|| tmpActionType == MotionEvent.ACTION_DOWN) {
if (SDK_VERSION>=14) {
final int typeOfPointer = _event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
if ( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
m_galeNative.inputEventState(_event.getPointerId(0), true, (float)_event.getX(0), (float)_event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
m_galeNative.mouseEventState(_event.getPointerId(0), true, (float)_event.getX(0), (float)_event.getY(0));
@ -101,13 +101,13 @@ public class GaleSurfaceViewGL extends GLSurfaceView implements GaleConstants {
m_galeNative.inputEventState(_event.getPointerId(0), true, (float)_event.getX(0), (float)_event.getY(0));
}
inputDown1 = true;
} else if(tmpActionType == MotionEvent.ACTION_POINTER_1_UP) {
if (SDK_VERSION>=14) {
} else if (tmpActionType == MotionEvent.ACTION_POINTER_1_UP) {
if (SDK_VERSION >= 14) {
final int typeOfPointer = _event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
if ( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
m_galeNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
} else if (typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
m_galeNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
}
} else {
@ -117,8 +117,8 @@ public class GaleSurfaceViewGL extends GLSurfaceView implements GaleConstants {
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_DOWN) {
if (SDK_VERSION>=14) {
final int typeOfPointer = _event.getToolType(1);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
if ( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
m_galeNative.inputEventState(_event.getPointerId(1), true, (float)_event.getX(1), (float)_event.getY(1));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
m_galeNative.mouseEventState(_event.getPointerId(1), true, (float)_event.getX(1), (float)_event.getY(1));
@ -130,8 +130,8 @@ public class GaleSurfaceViewGL extends GLSurfaceView implements GaleConstants {
} else if (tmpActionType == MotionEvent.ACTION_POINTER_2_UP) {
if (SDK_VERSION>=14) {
final int typeOfPointer = _event.getToolType(1);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
if ( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
m_galeNative.inputEventState(_event.getPointerId(1), false, (float)_event.getX(1), (float)_event.getY(1));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
m_galeNative.mouseEventState(_event.getPointerId(1), false, (float)_event.getX(1), (float)_event.getY(1));
@ -141,10 +141,10 @@ public class GaleSurfaceViewGL extends GLSurfaceView implements GaleConstants {
}
inputDown2 = false;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_DOWN) {
if (SDK_VERSION>=14) {
if (SDK_VERSION >= 14) {
final int typeOfPointer = _event.getToolType(2);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
if ( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
m_galeNative.inputEventState(_event.getPointerId(2), true, (float)_event.getX(2), (float)_event.getY(2));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
m_galeNative.mouseEventState(_event.getPointerId(2), true, (float)_event.getX(2), (float)_event.getY(2));
@ -154,10 +154,10 @@ public class GaleSurfaceViewGL extends GLSurfaceView implements GaleConstants {
}
inputDown3 = true;
} else if (tmpActionType == MotionEvent.ACTION_POINTER_3_UP) {
if (SDK_VERSION>=14) {
if (SDK_VERSION >= 14) {
final int typeOfPointer = _event.getToolType(2);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
if ( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
m_galeNative.inputEventState(_event.getPointerId(2), false, (float)_event.getX(2), (float)_event.getY(2));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
m_galeNative.mouseEventState(_event.getPointerId(2), false, (float)_event.getX(2), (float)_event.getY(2));
@ -168,10 +168,10 @@ public class GaleSurfaceViewGL extends GLSurfaceView implements GaleConstants {
inputDown3 = false;
} else if(tmpActionType == MotionEvent.ACTION_UP){
if (inputDown1) {
if (SDK_VERSION>=14) {
if (SDK_VERSION >= 14) {
final int typeOfPointer = _event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
if ( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
m_galeNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
m_galeNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
@ -181,10 +181,10 @@ public class GaleSurfaceViewGL extends GLSurfaceView implements GaleConstants {
}
inputDown1 = false;
} else if (inputDown2) {
if (SDK_VERSION>=14) {
if (SDK_VERSION >= 14) {
final int typeOfPointer = _event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
if ( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
m_galeNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
m_galeNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
@ -194,10 +194,10 @@ public class GaleSurfaceViewGL extends GLSurfaceView implements GaleConstants {
}
inputDown2 = false;
} else {
if (SDK_VERSION>=14) {
if (SDK_VERSION >= 14) {
final int typeOfPointer = _event.getToolType(0);
if( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
if ( typeOfPointer == MotionEvent.TOOL_TYPE_FINGER
|| typeOfPointer == MotionEvent.TOOL_TYPE_STYLUS) {
m_galeNative.inputEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));
} else if(typeOfPointer == MotionEvent.TOOL_TYPE_MOUSE) {
m_galeNative.mouseEventState(_event.getPointerId(0), false, (float)_event.getX(0), (float)_event.getY(0));

View File

@ -713,19 +713,19 @@ extern "C" {
jobject _thiz,
jint _id,
jint _pointerID,
jboolean _isUp,
jboolean _isDown,
jfloat _x,
jfloat _y) {
std::unique_lock<std::mutex> lock(g_interfaceMutex);
if( _id >= (int32_t)s_listInstance.size()
|| _id<0
|| nullptr == s_listInstance[_id] ) {
|| _id < 0
|| s_listInstance[_id] == nullptr ) {
GALE_ERROR("Call C With an incorrect instance _id=" << (int32_t)_id);
// TODO : generate error in java to stop the current instance
return;
}
s_listInstance[_id]->OS_SetInput(gale::key::type_finger,
(_isUp==false?gale::key::status_down:gale::key::status_up),
(_isDown==true?gale::key::status_down:gale::key::status_up),
_pointerID+1,
vec2(_x,_y));
}
@ -754,7 +754,7 @@ extern "C" {
jobject _thiz,
jint _id,
jint _pointerID,
jboolean _isUp,
jboolean _isDown,
jfloat _x,
jfloat _y) {
std::unique_lock<std::mutex> lock(g_interfaceMutex);
@ -766,7 +766,7 @@ extern "C" {
return;
}
s_listInstance[_id]->OS_SetInput(gale::key::type_mouse,
(_isUp==false?gale::key::status_down:gale::key::status_up),
(_isDown==true?gale::key::status_down:gale::key::status_up),
_pointerID+1,
vec2(_x,_y));
}