mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-06 03:18:14 +00:00
Minor tweaks to raylib events automation system
This commit is contained in:
20
src/rcore.c
20
src/rcore.c
@@ -595,14 +595,14 @@ static const char *autoEventTypeName[] = {
|
|||||||
"ACTION_SETTARGETFPS"
|
"ACTION_SETTARGETFPS"
|
||||||
};
|
};
|
||||||
|
|
||||||
// Automation Event (20 bytes)
|
// Automation Event (24 bytes)
|
||||||
typedef struct AutomationEvent {
|
typedef struct AutomationEvent {
|
||||||
unsigned int frame; // Event frame
|
unsigned int frame; // Event frame
|
||||||
unsigned int type; // Event type (AutoEventType)
|
unsigned int type; // Event type (AutomationEventType)
|
||||||
int params[3]; // Event parameters (if required)
|
int params[4]; // Event parameters (if required)
|
||||||
} AutomationEvent;
|
} AutomationEvent;
|
||||||
|
|
||||||
static AutomationEvent *events = NULL; // Events array
|
static AutomationEvent *events = NULL; // Events array
|
||||||
static unsigned int eventCount = 0; // Events count
|
static unsigned int eventCount = 0; // Events count
|
||||||
static bool eventsPlaying = false; // Play events
|
static bool eventsPlaying = false; // Play events
|
||||||
static bool eventsRecording = false; // Record events
|
static bool eventsRecording = false; // Record events
|
||||||
@@ -925,7 +925,7 @@ void InitWindow(int width, int height, const char *title)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_EVENTS_AUTOMATION)
|
#if defined(SUPPORT_EVENTS_AUTOMATION)
|
||||||
events = (AutomationEvent *)malloc(MAX_CODE_AUTOMATION_EVENTS*sizeof(AutomationEvent));
|
events = (AutomationEvent *)RL_CALLOC(MAX_CODE_AUTOMATION_EVENTS, sizeof(AutomationEvent));
|
||||||
CORE.Time.frameCounter = 0;
|
CORE.Time.frameCounter = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1073,7 +1073,7 @@ void CloseWindow(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_EVENTS_AUTOMATION)
|
#if defined(SUPPORT_EVENTS_AUTOMATION)
|
||||||
free(events);
|
RL_FREE(events);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CORE.Window.ready = false;
|
CORE.Window.ready = false;
|
||||||
@@ -6945,11 +6945,11 @@ static int FindNearestConnectorMode(const drmModeConnector *connector, uint widt
|
|||||||
// TODO: This system should probably be redesigned
|
// TODO: This system should probably be redesigned
|
||||||
static void LoadAutomationEvents(const char *fileName)
|
static void LoadAutomationEvents(const char *fileName)
|
||||||
{
|
{
|
||||||
//unsigned char fileId[4] = { 0 };
|
// Load events file (binary)
|
||||||
|
|
||||||
// Load binary
|
|
||||||
/*
|
/*
|
||||||
FILE *repFile = fopen(fileName, "rb");
|
FILE *repFile = fopen(fileName, "rb");
|
||||||
|
unsigned char fileId[4] = { 0 };
|
||||||
|
|
||||||
fread(fileId, 1, 4, repFile);
|
fread(fileId, 1, 4, repFile);
|
||||||
|
|
||||||
if ((fileId[0] == 'r') && (fileId[1] == 'E') && (fileId[2] == 'P') && (fileId[1] == ' '))
|
if ((fileId[0] == 'r') && (fileId[1] == 'E') && (fileId[2] == 'P') && (fileId[1] == ' '))
|
||||||
@@ -6962,7 +6962,7 @@ static void LoadAutomationEvents(const char *fileName)
|
|||||||
fclose(repFile);
|
fclose(repFile);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Load events (text file)
|
// Load events file (text)
|
||||||
FILE *repFile = fopen(fileName, "rt");
|
FILE *repFile = fopen(fileName, "rt");
|
||||||
|
|
||||||
if (repFile != NULL)
|
if (repFile != NULL)
|
||||||
|
Reference in New Issue
Block a user