mirror of
https://github.com/raysan5/raylib.git
synced 2026-07-31 04:38:54 +00:00
Update rcore_desktop_glfw.c
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user