From 8a2da96eed62171ebfeaceed61907b0ec1069549 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 28 Jan 2026 19:34:55 +0100 Subject: [PATCH] Reviewed formating and spacing --- src/rcore.c | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/src/rcore.c b/src/rcore.c index 42d92547e..503eea086 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1936,7 +1936,7 @@ void TraceLog(int logType, const char *text, ...) // Set custom trace log void SetTraceLogCallback(TraceLogCallback callback) -{ +{ traceLog = callback; } @@ -2771,7 +2771,7 @@ FilePathList LoadDirectoryFilesEx(const char *basePath, const char *filter, bool { // SCAN 1: Count files unsigned int fileCounter = GetDirectoryFileCountEx(basePath, filter, scanSubdirs); - + // Memory allocation for dirFileCount 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)); @@ -3670,13 +3670,13 @@ bool ExportAutomationEventList(AutomationEventList list, const char *fileName) int binarySize = 4 + sizeof(int) + sizeof(AutomationEvent)*list.count; unsigned char *binBuffer = (unsigned char *)RL_CALLOC(binarySize, 1); int offset = 0; - memcpy(binBuffer + offset, "rAE ", 4); + memcpy(binBuffer + offset, "rAE ", 4); offset += 4; - memcpy(binBuffer + offset, &list.count, sizeof(int)); + memcpy(binBuffer + offset, &list.count, sizeof(int)); offset += sizeof(int); memcpy(binBuffer + offset, list.events, sizeof(AutomationEvent)*list.count); offset += sizeof(AutomationEvent)*list.count; - + success = SaveFileData(TextFormat("%s.rae",fileName), binBuffer, binarySize); RL_FREE(binBuffer); } @@ -3831,7 +3831,6 @@ void PlayAutomationEvent(AutomationEvent event) // Check if a key has been pressed once bool IsKeyPressed(int key) { - bool pressed = false; if ((key > 0) && (key < MAX_KEYBOARD_KEYS)) @@ -4052,17 +4051,15 @@ float GetGamepadAxisMovement(int gamepad, int axis) bool IsMouseButtonPressed(int button) { bool pressed = false; - + if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) { - if ((CORE.Input.Mouse.currentButtonState[button] == 1) && (CORE.Input.Mouse.previousButtonState[button] == 0)) pressed = true; // Map touches to mouse buttons checking if ((CORE.Input.Touch.currentTouchState[button] == 1) && (CORE.Input.Touch.previousTouchState[button] == 0)) pressed = true; - } - + return pressed; } @@ -4070,17 +4067,15 @@ bool IsMouseButtonPressed(int button) bool IsMouseButtonDown(int button) { bool down = false; - + if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) { - if (CORE.Input.Mouse.currentButtonState[button] == 1) down = true; // NOTE: Touches are considered like mouse buttons if (CORE.Input.Touch.currentTouchState[button] == 1) down = true; - } - + return down; } @@ -4088,17 +4083,15 @@ bool IsMouseButtonDown(int button) bool IsMouseButtonReleased(int button) { bool released = false; - + if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) { - if ((CORE.Input.Mouse.currentButtonState[button] == 0) && (CORE.Input.Mouse.previousButtonState[button] == 1)) released = true; // Map touches to mouse buttons checking if ((CORE.Input.Touch.currentTouchState[button] == 0) && (CORE.Input.Touch.previousTouchState[button] == 1)) released = true; - } - + return released; } @@ -4106,17 +4099,15 @@ bool IsMouseButtonReleased(int button) bool IsMouseButtonUp(int button) { bool up = false; - + if ((button >= 0) && (button <= MOUSE_BUTTON_BACK)) { - if (CORE.Input.Mouse.currentButtonState[button] == 0) up = true; // NOTE: Touches are considered like mouse buttons if (CORE.Input.Touch.currentTouchState[button] == 0) up = true; - } - + return up; } @@ -4124,6 +4115,7 @@ bool IsMouseButtonUp(int button) int GetMouseX(void) { int mouseX = (int)((CORE.Input.Mouse.currentPosition.x + CORE.Input.Mouse.offset.x)*CORE.Input.Mouse.scale.x); + return mouseX; } @@ -4131,6 +4123,7 @@ int GetMouseX(void) int GetMouseY(void) { int mouseY = (int)((CORE.Input.Mouse.currentPosition.y + CORE.Input.Mouse.offset.y)*CORE.Input.Mouse.scale.y); + return mouseY; } @@ -4490,7 +4483,7 @@ static void RecordAutomationEvent(void) 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) || ((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]); currentEventList->count++; } - + if (currentEventList->count == currentEventList->capacity) return; // Security check }