mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-18 13:41:26 +01:00
[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:
25
src/rcore.c
25
src/rcore.c
@ -350,11 +350,12 @@ typedef struct CoreData {
|
|||||||
|
|
||||||
} Mouse;
|
} Mouse;
|
||||||
struct {
|
struct {
|
||||||
int pointCount; // Number of touch points active
|
int pointCount; // Number of touch points active
|
||||||
int pointId[MAX_TOUCH_POINTS]; // Point identifiers
|
int pointId[MAX_TOUCH_POINTS]; // Point identifiers
|
||||||
Vector2 position[MAX_TOUCH_POINTS]; // Touch position on screen
|
Vector2 position[MAX_TOUCH_POINTS]; // Touch position on screen
|
||||||
char currentTouchState[MAX_TOUCH_POINTS]; // Registers current touch state
|
Vector2 previousPosition[MAX_TOUCH_POINTS]; // Previous touch position on screen
|
||||||
char previousTouchState[MAX_TOUCH_POINTS]; // Registers previous touch state
|
char currentTouchState[MAX_TOUCH_POINTS]; // Registers current touch state
|
||||||
|
char previousTouchState[MAX_TOUCH_POINTS]; // Registers previous touch state
|
||||||
|
|
||||||
} Touch;
|
} Touch;
|
||||||
struct {
|
struct {
|
||||||
@ -4104,22 +4105,20 @@ static void RecordAutomationEvent(void)
|
|||||||
|
|
||||||
if (currentEventList->count == currentEventList->capacity) return; // Security check
|
if (currentEventList->count == currentEventList->capacity) return; // Security check
|
||||||
|
|
||||||
// Event type: INPUT_TOUCH_POSITION
|
// Event type: INPUT_TOUCH_POSITION
|
||||||
// TODO: It requires the id!
|
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))
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
currentEventList->events[currentEventList->count].frame = CORE.Time.frameCounter;
|
currentEventList->events[currentEventList->count].frame = CORE.Time.frameCounter;
|
||||||
currentEventList->events[currentEventList->count].type = INPUT_TOUCH_POSITION;
|
currentEventList->events[currentEventList->count].type = INPUT_TOUCH_POSITION;
|
||||||
currentEventList->events[currentEventList->count].params[0] = id;
|
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[1] = (int)CORE.Input.Touch.position[id].x;
|
||||||
currentEventList->events[currentEventList->count].params[2] = (int)CORE.Input.Touch.currentPosition[id].y;
|
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]);
|
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++;
|
currentEventList->count++;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
if (currentEventList->count == currentEventList->capacity) return; // Security check
|
if (currentEventList->count == currentEventList->capacity) return; // Security check
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user