Code gardening

This commit is contained in:
Ray 2026-08-04 21:16:08 +02:00
commit 7711de62fb
14 changed files with 40 additions and 45 deletions

2
src/external/rlsw.h vendored
View file

@ -774,7 +774,7 @@ SWAPI void swGetFramebufferAttachmentParameteriv(SWattachment attachment, SWatta
// Simple log system to avoid printf() calls if required
// NOTE: Avoiding those calls, also avoids const strings memory usage
#define RLSW_SUPPORT_LOG_INFO
#if defined(RLSW_SUPPORT_LOG_INFO) //&& defined(_DEBUG) // WARNING: LOG() output required for this tool
#if defined(RLSW_SUPPORT_LOG_INFO)
#include <stdio.h>
#define SW_LOG(...) printf(__VA_ARGS__)
#else

View file

@ -1613,11 +1613,11 @@ void PollInputEvents(void)
}
//-----------------------------------------------------------------------------
// using RGFW callbacks instead of polling
// Using RGFW callbacks instead of polling
RGFW_pollEvents();
//-----------------------------------------------------------------------------
mg_event gamepad_event;
mg_event gamepad_event = { 0 };
while (mg_gamepads_check_event(&platform.minigamepad, &gamepad_event))
{
int gamepadIndex = gamepad_event.gamepad->index;

View file

@ -1652,7 +1652,7 @@ void PollInputEvents(void)
} break;
#endif
// Keyboard events
// Check keyboard events
case SDL_KEYDOWN:
{
#if defined(USING_VERSION_SDL3)
@ -1680,10 +1680,8 @@ void PollInputEvents(void)
if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey]) CORE.Window.shouldClose = true;
} break;
case SDL_KEYUP:
{
#if defined(USING_VERSION_SDL3)
KeyboardKey key = ConvertScancodeToKey(event.key.scancode);
#else
@ -1691,7 +1689,6 @@ void PollInputEvents(void)
#endif
if (key != KEY_NULL) CORE.Input.Keyboard.currentKeyState[key] = 0;
} break;
case SDL_TEXTINPUT:
{
// NOTE: event.text.text data comes an UTF-8 text sequence but register codepoints (int)
@ -1700,7 +1697,6 @@ void PollInputEvents(void)
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
{
// Add character (codepoint) to the queue
#if defined(USING_VERSION_SDL3)
size_t textLen = strlen(event.text.text);
unsigned int codepoint = (unsigned int)SDL_StepUTF8(&event.text.text, &textLen);
@ -1769,6 +1765,7 @@ void PollInputEvents(void)
touchAction = 2;
} break;
// Check Touch events
case SDL_FINGERDOWN:
{
UpdateTouchPointsSDL(event.tfinger);
@ -1788,24 +1785,21 @@ void PollInputEvents(void)
realTouch = true;
} break;
// Check gamepad events
// Check Gamepad events
case SDL_JOYDEVICEADDED:
{
int jid = event.jdevice.which; // Joystick device index
// check if already added at InitPlatform
// Check if already added at InitPlatform
for (int i = 0; i < MAX_GAMEPADS; i++)
{
if (jid == platform.gamepadId[i])
{
return;
}
if (jid == platform.gamepadId[i]) return;
}
int nextAvailableSlot = 0;
while (nextAvailableSlot < MAX_GAMEPADS && CORE.Input.Gamepad.ready[nextAvailableSlot])
{
++nextAvailableSlot;
nextAvailableSlot++;
}
if ((nextAvailableSlot < MAX_GAMEPADS) && !CORE.Input.Gamepad.ready[nextAvailableSlot])

View file

@ -1118,7 +1118,7 @@ void PollInputEvents(void)
// NOTE: For DRM touchscreen devices, this mapping is disabled to avoid false touch detection
// CORE.Input.Touch.position[0] = CORE.Input.Mouse.currentPosition;
// Handle the mouse/touch/gestures events:
// Handle the mouse/touch/gestures events
PollMouseEvents();
}
@ -1938,6 +1938,7 @@ static void InitEvdevInput(void)
(strncmp("mouse", entity->d_name, strlen("mouse")) == 0)) // Search for devices named "mouse*"
{
snprintf(path, MAX_FILEPATH_LENGTH, "%s%s", DEFAULT_EVDEV_PATH, entity->d_name);
ConfigureEvdevDevice(path); // Configure the device if appropriate
}
}

View file

@ -477,7 +477,7 @@ void PollInputEvents(void)
if (kbhit())
{
int key = getch();
if (key == 27) CORE.Window.shouldClose = true; // KEY_SCAPE
if (key == 27) CORE.Window.shouldClose = true; // KEY_ESCAPE
}
}

View file

@ -1128,7 +1128,7 @@ void PollInputEvents(void)
// Register previous gamepad button states
for (int k = 0; k < MAX_GAMEPAD_BUTTONS; k++) CORE.Input.Gamepad.previousButtonState[i][k] = CORE.Input.Gamepad.currentButtonState[i][k];
EmscriptenGamepadEvent gamepadState;
EmscriptenGamepadEvent gamepadState = { 0 };
int result = emscripten_get_gamepad_status(i, &gamepadState);

View file

@ -353,7 +353,7 @@ void ProcessGestureEvent(GestureEvent event)
GESTURES.Drag.vector.y = GESTURES.Touch.moveDownPositionA.y - GESTURES.Touch.downDragPosition.y;
}
}
else if (GESTURES.Touch.pointCount == 2) // Two touch points
else if (GESTURES.Touch.pointCount == 2)
{
if (event.touchAction == TOUCH_ACTION_DOWN)
{