summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorLe Juez Victor <[email protected]>2023-10-13 16:36:42 +0200
committerGitHub <[email protected]>2023-10-13 16:36:42 +0200
commit0daa5ce1e71963577a2bcf6140df2d71d8e6c730 (patch)
treea8b25049c362c464be12471a26fbd80e3220be62 /src
parent2e65bc675ce2ef92ccc784e25739b27edd7be94b (diff)
downloadraylib-0daa5ce1e71963577a2bcf6140df2d71d8e6c730.tar.gz
raylib-0daa5ce1e71963577a2bcf6140df2d71d8e6c730.zip
Fix `GetMouseDelta()` issue for Android (#3404)
Diffstat (limited to 'src')
-rw-r--r--src/rcore_android.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/rcore_android.c b/src/rcore_android.c
index 7cc71bbc..5f6f34ba 100644
--- a/src/rcore_android.c
+++ b/src/rcore_android.c
@@ -1178,6 +1178,16 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event)
if (CORE.Input.Touch.pointCount > 0) CORE.Input.Touch.currentTouchState[MOUSE_BUTTON_LEFT] = 1;
else CORE.Input.Touch.currentTouchState[MOUSE_BUTTON_LEFT] = 0;
+ // Stores the previous position of touch[0] only while it's active to calculate the delta.
+ if (flags == AMOTION_EVENT_ACTION_MOVE)
+ {
+ CORE.Input.Mouse.previousPosition = CORE.Input.Mouse.currentPosition;
+ }
+ else
+ {
+ CORE.Input.Mouse.previousPosition = CORE.Input.Touch.position[0];
+ }
+
// Map touch[0] as mouse input for convenience
CORE.Input.Mouse.currentPosition = CORE.Input.Touch.position[0];
CORE.Input.Mouse.currentWheelMove = (Vector2){ 0.0f, 0.0f };