Skip to content

Commit fc009a6

Browse files
committed
[rcore][SDL2] First touch position is overwritten with mouse pos
I believe it makes sense to only do this when there are no known touch points. I am not even sure if this should be done at all. See raysan5#4869 for more information.
1 parent b529f52 commit fc009a6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/platforms/rcore_desktop_sdl.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,10 @@ void PollInputEvents(void)
13631363
for (int i = 0; i < MAX_TOUCH_POINTS; i++) CORE.Input.Touch.previousTouchState[i] = CORE.Input.Touch.currentTouchState[i];
13641364

13651365
// Map touch position to mouse position for convenience
1366-
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
1366+
if (CORE.Input.Touch.pointCount == 0)
1367+
{
1368+
CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
1369+
}
13671370

13681371
int touchAction = -1; // 0-TOUCH_ACTION_UP, 1-TOUCH_ACTION_DOWN, 2-TOUCH_ACTION_MOVE
13691372
bool realTouch = false; // Flag to differentiate real touch gestures from mouse ones

0 commit comments

Comments
 (0)