Update rcore_desktop_glfw.c

This commit is contained in:
Ray
2026-07-16 12:28:25 +02:00
parent 89b4fbd298
commit 8eb613e50a

View File

@@ -1325,7 +1325,7 @@ void PollInputEvents(void)
// Register previous gamepad states
for (int k = 0; k < MAX_GAMEPAD_BUTTONS; k++) CORE.Input.Gamepad.previousButtonState[i][k] = CORE.Input.Gamepad.currentButtonState[i][k];
// Get current gamepad state
// Get current gamepad state using internal GLFW mapping, instead of the immediate joystick API
// NOTE: There is no callback available, getting it manually
GLFWgamepadstate state = { 0 };
int result = glfwGetGamepadState(i, &state); // This remaps all gamepads so they have their buttons mapped like an xbox controller
@@ -1340,7 +1340,7 @@ void PollInputEvents(void)
for (int k = 0; (buttons != NULL) && (k < MAX_GAMEPAD_BUTTONS); k++)
{
int button = -1; // GamepadButton enum values assigned
int button = -1; // GamepadButton enum values assigned
switch (k)
{
@@ -1366,7 +1366,7 @@ void PollInputEvents(void)
default: break;
}
if (button != -1) // Check for valid button
if (button != -1) // Check for valid button
{
if (buttons[k] == GLFW_PRESS)
{
@@ -1408,10 +1408,10 @@ void PollInputEvents(void)
if ((CORE.Window.eventWaiting) ||
(FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_MINIMIZED) && !FLAG_IS_SET(CORE.Window.flags, FLAG_WINDOW_ALWAYS_RUN)))
{
glfwWaitEvents(); // Wait for in input events before continue (drawing is paused)
glfwWaitEvents(); // Wait for in input events before continue (drawing is paused)
CORE.Time.previous = GetTime();
}
else glfwPollEvents(); // Poll input events: keyboard/mouse/window events (callbacks) -> Update keys state
else glfwPollEvents(); // Poll input events: keyboard/mouse/window events (callbacks) -> Update keys state
CORE.Window.shouldClose = glfwWindowShouldClose(platform.handle);