Android touch fix: check for POINTER_UP and UP events
This commit is contained in:
parent
460eba53c7
commit
c0da7f1065
11
src/rcore.c
11
src/rcore.c
|
|
@ -5439,6 +5439,14 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t action = AMotionEvent_getAction(event);
|
||||||
|
unsigned int flags = action & AMOTION_EVENT_ACTION_MASK;
|
||||||
|
|
||||||
|
// Don't register pointers lifted during this action,
|
||||||
|
// otherwise they get stuck until next pointer event
|
||||||
|
if (flags == AMOTION_EVENT_ACTION_POINTER_UP || flags == AMOTION_EVENT_ACTION_UP)
|
||||||
|
CORE.Input.Touch.pointCount -= 1;
|
||||||
|
|
||||||
// Register touch points count
|
// Register touch points count
|
||||||
CORE.Input.Touch.pointCount = AMotionEvent_getPointerCount(event);
|
CORE.Input.Touch.pointCount = AMotionEvent_getPointerCount(event);
|
||||||
|
|
||||||
|
|
@ -5455,9 +5463,6 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
|
||||||
CORE.Input.Touch.position[i].y /= (float)GetScreenHeight();
|
CORE.Input.Touch.position[i].y /= (float)GetScreenHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t action = AMotionEvent_getAction(event);
|
|
||||||
unsigned int flags = action & AMOTION_EVENT_ACTION_MASK;
|
|
||||||
|
|
||||||
if (flags == AMOTION_EVENT_ACTION_DOWN || flags == AMOTION_EVENT_ACTION_MOVE) CORE.Input.Touch.currentTouchState[MOUSE_BUTTON_LEFT] = 1;
|
if (flags == AMOTION_EVENT_ACTION_DOWN || flags == AMOTION_EVENT_ACTION_MOVE) CORE.Input.Touch.currentTouchState[MOUSE_BUTTON_LEFT] = 1;
|
||||||
else if (flags == AMOTION_EVENT_ACTION_UP) CORE.Input.Touch.currentTouchState[MOUSE_BUTTON_LEFT] = 0;
|
else if (flags == AMOTION_EVENT_ACTION_UP) CORE.Input.Touch.currentTouchState[MOUSE_BUTTON_LEFT] = 0;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user