Skip to content

Commit af544c2

Browse files
authored
[rcore] Fix touch position automation event handling (#5470)
* fix touch position automation event handling * Fix alignment of previousPosition comment in rcore.c
1 parent c4b11a3 commit af544c2

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/rcore.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,12 @@ typedef struct CoreData {
350350

351351
} Mouse;
352352
struct {
353-
int pointCount; // Number of touch points active
354-
int pointId[MAX_TOUCH_POINTS]; // Point identifiers
355-
Vector2 position[MAX_TOUCH_POINTS]; // Touch position on screen
356-
char currentTouchState[MAX_TOUCH_POINTS]; // Registers current touch state
357-
char previousTouchState[MAX_TOUCH_POINTS]; // Registers previous touch state
353+
int pointCount; // Number of touch points active
354+
int pointId[MAX_TOUCH_POINTS]; // Point identifiers
355+
Vector2 position[MAX_TOUCH_POINTS]; // Touch position on screen
356+
Vector2 previousPosition[MAX_TOUCH_POINTS]; // Previous touch position on screen
357+
char currentTouchState[MAX_TOUCH_POINTS]; // Registers current touch state
358+
char previousTouchState[MAX_TOUCH_POINTS]; // Registers previous touch state
358359

359360
} Touch;
360361
struct {
@@ -4104,22 +4105,20 @@ static void RecordAutomationEvent(void)
41044105

41054106
if (currentEventList->count == currentEventList->capacity) return; // Security check
41064107

4107-
// Event type: INPUT_TOUCH_POSITION
4108-
// TODO: It requires the id!
4109-
/*
4110-
if (((int)CORE.Input.Touch.currentPosition[id].x != (int)CORE.Input.Touch.previousPosition[id].x) ||
4111-
((int)CORE.Input.Touch.currentPosition[id].y != (int)CORE.Input.Touch.previousPosition[id].y))
4108+
// Event type: INPUT_TOUCH_POSITION
4109+
if (((int)CORE.Input.Touch.position[id].x != (int)CORE.Input.Touch.previousPosition[id].x) ||
4110+
((int)CORE.Input.Touch.position[id].y != (int)CORE.Input.Touch.previousPosition[id].y))
41124111
{
41134112
currentEventList->events[currentEventList->count].frame = CORE.Time.frameCounter;
41144113
currentEventList->events[currentEventList->count].type = INPUT_TOUCH_POSITION;
41154114
currentEventList->events[currentEventList->count].params[0] = id;
4116-
currentEventList->events[currentEventList->count].params[1] = (int)CORE.Input.Touch.currentPosition[id].x;
4117-
currentEventList->events[currentEventList->count].params[2] = (int)CORE.Input.Touch.currentPosition[id].y;
4115+
currentEventList->events[currentEventList->count].params[1] = (int)CORE.Input.Touch.position[id].x;
4116+
currentEventList->events[currentEventList->count].params[2] = (int)CORE.Input.Touch.position[id].y;
41184117

41194118
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]);
41204119
currentEventList->count++;
41214120
}
4122-
*/
4121+
41234122

41244123
if (currentEventList->count == currentEventList->capacity) return; // Security check
41254124
}

0 commit comments

Comments
 (0)