|
|
@ -1936,7 +1936,7 @@ void TraceLog(int logType, const char *text, ...) |
|
|
|
|
|
|
|
|
// Set custom trace log |
|
|
// Set custom trace log |
|
|
void SetTraceLogCallback(TraceLogCallback callback) |
|
|
void SetTraceLogCallback(TraceLogCallback callback) |
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
traceLog = callback; |
|
|
traceLog = callback; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -2771,7 +2771,7 @@ FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool |
|
|
{ |
|
|
{ |
|
|
// SCAN 1: Count files |
|
|
// SCAN 1: Count files |
|
|
unsigned int fileCounter = GetDirectoryFileCountEx(basePath, filter, scanSubdirs); |
|
|
unsigned int fileCounter = GetDirectoryFileCountEx(basePath, filter, scanSubdirs); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Memory allocation for dirFileCount |
|
|
// Memory allocation for dirFileCount |
|
|
files.paths = (char **)RL_CALLOC(fileCounter, sizeof(char *)); |
|
|
files.paths = (char **)RL_CALLOC(fileCounter, sizeof(char *)); |
|
|
for (unsigned int i = 0; i < fileCounter; i++) files.paths[i] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char)); |
|
|
for (unsigned int i = 0; i < fileCounter; i++) files.paths[i] = (char *)RL_CALLOC(MAX_FILEPATH_LENGTH, sizeof(char)); |
|
|
@ -3670,13 +3670,13 @@ bool ExportAutomationEventList(AutomationEventList list, const char *fileName) |
|
|
int binarySize = 4 + sizeof(int) + sizeof(AutomationEvent)*list.count; |
|
|
int binarySize = 4 + sizeof(int) + sizeof(AutomationEvent)*list.count; |
|
|
unsigned char *binBuffer = (unsigned char *)RL_CALLOC(binarySize, 1); |
|
|
unsigned char *binBuffer = (unsigned char *)RL_CALLOC(binarySize, 1); |
|
|
int offset = 0; |
|
|
int offset = 0; |
|
|
memcpy(binBuffer + offset, "rAE ", 4); |
|
|
|
|
|
|
|
|
memcpy(binBuffer + offset, "rAE ", 4); |
|
|
offset += 4; |
|
|
offset += 4; |
|
|
memcpy(binBuffer + offset, &list.count, sizeof(int)); |
|
|
|
|
|
|
|
|
memcpy(binBuffer + offset, &list.count, sizeof(int)); |
|
|
offset += sizeof(int); |
|
|
offset += sizeof(int); |
|
|
memcpy(binBuffer + offset, list.events, sizeof(AutomationEvent)*list.count); |
|
|
memcpy(binBuffer + offset, list.events, sizeof(AutomationEvent)*list.count); |
|
|
offset += sizeof(AutomationEvent)*list.count; |
|
|
offset += sizeof(AutomationEvent)*list.count; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
success = SaveFileData(TextFormat("%s.rae",fileName), binBuffer, binarySize); |
|
|
success = SaveFileData(TextFormat("%s.rae",fileName), binBuffer, binarySize); |
|
|
RL_FREE(binBuffer); |
|
|
RL_FREE(binBuffer); |
|
|
} |
|
|
} |
|
|
@ -3831,7 +3831,6 @@ void PlayAutomationEvent(AutomationEvent event) |
|
|
// Check if a key has been pressed once |
|
|
// Check if a key has been pressed once |
|
|
bool IsKeyPressed(int key) |
|
|
bool IsKeyPressed(int key) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
bool pressed = false; |
|
|
bool pressed = false; |
|
|
|
|
|
|
|
|
if ((key > 0) && (key < MAX_KEYBOARD_KEYS)) |
|
|
if ((key > 0) && (key < MAX_KEYBOARD_KEYS)) |
|
|
@ -4052,17 +4051,15 @@ float GetGamepadAxisMovement(int gamepad, int axis) |
|
|
bool IsMouseButtonPressed(int button) |
|
|
bool IsMouseButtonPressed(int button) |
|
|
{ |
|
|
{ |
|
|
bool pressed = false; |
|
|
bool pressed = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) |
|
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
if ((CORE.Input.Mouse.currentButtonState[button] == 1) && (CORE.Input.Mouse.previousButtonState[button] == 0)) pressed = true; |
|
|
if ((CORE.Input.Mouse.currentButtonState[button] == 1) && (CORE.Input.Mouse.previousButtonState[button] == 0)) pressed = true; |
|
|
|
|
|
|
|
|
// Map touches to mouse buttons checking |
|
|
// Map touches to mouse buttons checking |
|
|
if ((CORE.Input.Touch.currentTouchState[button] == 1) && (CORE.Input.Touch.previousTouchState[button] == 0)) pressed = true; |
|
|
if ((CORE.Input.Touch.currentTouchState[button] == 1) && (CORE.Input.Touch.previousTouchState[button] == 0)) pressed = true; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return pressed; |
|
|
return pressed; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -4070,17 +4067,15 @@ bool IsMouseButtonPressed(int button) |
|
|
bool IsMouseButtonDown(int button) |
|
|
bool IsMouseButtonDown(int button) |
|
|
{ |
|
|
{ |
|
|
bool down = false; |
|
|
bool down = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) |
|
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
if (CORE.Input.Mouse.currentButtonState[button] == 1) down = true; |
|
|
if (CORE.Input.Mouse.currentButtonState[button] == 1) down = true; |
|
|
|
|
|
|
|
|
// NOTE: Touches are considered like mouse buttons |
|
|
// NOTE: Touches are considered like mouse buttons |
|
|
if (CORE.Input.Touch.currentTouchState[button] == 1) down = true; |
|
|
if (CORE.Input.Touch.currentTouchState[button] == 1) down = true; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return down; |
|
|
return down; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -4088,17 +4083,15 @@ bool IsMouseButtonDown(int button) |
|
|
bool IsMouseButtonReleased(int button) |
|
|
bool IsMouseButtonReleased(int button) |
|
|
{ |
|
|
{ |
|
|
bool released = false; |
|
|
bool released = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) |
|
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
if ((CORE.Input.Mouse.currentButtonState[button] == 0) && (CORE.Input.Mouse.previousButtonState[button] == 1)) released = true; |
|
|
if ((CORE.Input.Mouse.currentButtonState[button] == 0) && (CORE.Input.Mouse.previousButtonState[button] == 1)) released = true; |
|
|
|
|
|
|
|
|
// Map touches to mouse buttons checking |
|
|
// Map touches to mouse buttons checking |
|
|
if ((CORE.Input.Touch.currentTouchState[button] == 0) && (CORE.Input.Touch.previousTouchState[button] == 1)) released = true; |
|
|
if ((CORE.Input.Touch.currentTouchState[button] == 0) && (CORE.Input.Touch.previousTouchState[button] == 1)) released = true; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return released; |
|
|
return released; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -4106,17 +4099,15 @@ bool IsMouseButtonReleased(int button) |
|
|
bool IsMouseButtonUp(int button) |
|
|
bool IsMouseButtonUp(int button) |
|
|
{ |
|
|
{ |
|
|
bool up = false; |
|
|
bool up = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) |
|
|
if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
if (CORE.Input.Mouse.currentButtonState[button] == 0) up = true; |
|
|
if (CORE.Input.Mouse.currentButtonState[button] == 0) up = true; |
|
|
|
|
|
|
|
|
// NOTE: Touches are considered like mouse buttons |
|
|
// NOTE: Touches are considered like mouse buttons |
|
|
if (CORE.Input.Touch.currentTouchState[button] == 0) up = true; |
|
|
if (CORE.Input.Touch.currentTouchState[button] == 0) up = true; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return up; |
|
|
return up; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -4124,6 +4115,7 @@ bool IsMouseButtonUp(int button) |
|
|
int GetMouseX(void) |
|
|
int GetMouseX(void) |
|
|
{ |
|
|
{ |
|
|
int mouseX = (int)((CORE.Input.Mouse.currentPosition.x + CORE.Input.Mouse.offset.x)*CORE.Input.Mouse.scale.x); |
|
|
int mouseX = (int)((CORE.Input.Mouse.currentPosition.x + CORE.Input.Mouse.offset.x)*CORE.Input.Mouse.scale.x); |
|
|
|
|
|
|
|
|
return mouseX; |
|
|
return mouseX; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -4131,6 +4123,7 @@ int GetMouseX(void) |
|
|
int GetMouseY(void) |
|
|
int GetMouseY(void) |
|
|
{ |
|
|
{ |
|
|
int mouseY = (int)((CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y); |
|
|
int mouseY = (int)((CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y); |
|
|
|
|
|
|
|
|
return mouseY; |
|
|
return mouseY; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -4490,7 +4483,7 @@ 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 |
|
|
if (((int)CORE.Input.Touch.position[id].x != (int)CORE.Input.Touch.previousPosition[id].x) || |
|
|
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)) |
|
|
((int)CORE.Input.Touch.position[id].y != (int)CORE.Input.Touch.previousPosition[id].y)) |
|
|
{ |
|
|
{ |
|
|
@ -4503,7 +4496,7 @@ static void RecordAutomationEvent(void) |
|
|
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 |
|
|
} |
|
|
} |
|
|
|