[rcore] Fix touch position automation event handling (#5470)

* fix touch position automation event handling

* Fix alignment of previousPosition comment in rcore.c
This commit is contained in:
ssszcmawo
2026-01-03 22:57:22 +01:00
committed by GitHub
parent c4b11a30cd
commit af544c24b9

View File

@ -350,11 +350,12 @@ typedef struct CoreData {
} Mouse;
struct {
int pointCount; // Number of touch points active
int pointId[MAX_TOUCH_POINTS]; // Point identifiers
Vector2 position[MAX_TOUCH_POINTS]; // Touch position on screen
char currentTouchState[MAX_TOUCH_POINTS]; // Registers current touch state
char previousTouchState[MAX_TOUCH_POINTS]; // Registers previous touch state
int pointCount; // Number of touch points active
int pointId[MAX_TOUCH_POINTS]; // Point identifiers
Vector2 position[MAX_TOUCH_POINTS]; // Touch position on screen
Vector2 previousPosition[MAX_TOUCH_POINTS]; // Previous touch position on screen
char currentTouchState[MAX_TOUCH_POINTS]; // Registers current touch state
char previousTouchState[MAX_TOUCH_POINTS]; // Registers previous touch state
} Touch;
struct {
@ -4104,22 +4105,20 @@ static void RecordAutomationEvent(void)
if (currentEventList->count == currentEventList->capacity) return; // Security check
// Event type: INPUT_TOUCH_POSITION
// TODO: It requires the id!
/*
if (((int)CORE.Input.Touch.currentPosition[id].x != (int)CORE.Input.Touch.previousPosition[id].x) ||
((int)CORE.Input.Touch.currentPosition[id].y != (int)CORE.Input.Touch.previousPosition[id].y))
// Event type: INPUT_TOUCH_POSITION
if (((int)CORE.Input.Touch.position[id].x != (int)CORE.Input.Touch.previousPosition[id].x) ||
((int)CORE.Input.Touch.position[id].y != (int)CORE.Input.Touch.previousPosition[id].y))
{
currentEventList->events[currentEventList->count].frame = CORE.Time.frameCounter;
currentEventList->events[currentEventList->count].type = INPUT_TOUCH_POSITION;
currentEventList->events[currentEventList->count].params[0] = id;
currentEventList->events[currentEventList->count].params[1] = (int)CORE.Input.Touch.currentPosition[id].x;
currentEventList->events[currentEventList->count].params[2] = (int)CORE.Input.Touch.currentPosition[id].y;
currentEventList->events[currentEventList->count].params[1] = (int)CORE.Input.Touch.position[id].x;
currentEventList->events[currentEventList->count].params[2] = (int)CORE.Input.Touch.position[id].y;
TRACELOG(LOG_INFO, "AUTOMATION: Frame: %i | Event type: INPUT_TOUCH_POSITION | Event parameters: %i, %i, %i", currentEventList->events[currentEventList->count].frame, currentEventList->events[currentEventList->count].params[0], currentEventList->events[currentEventList->count].params[1], currentEventList->events[currentEventList->count].params[2]);
currentEventList->count++;
}
*/
if (currentEventList->count == currentEventList->capacity) return; // Security check
}