mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-31 03:09:17 -05:00
[rcore] [GLFW] [SDL2] Updates CORE.Window.eventWaiting and FLAG_WINDOW_ALWAYS_RUN handling (#4642)
* Add implementation for CORE.Window.eventWaiting on PLATFORM_DESKTOP_SDL * Optimize GetFrameTime() reset * Optimize FLAG_WINDOW_ALWAYS_RUN and GetFrameTime() reset for PLATFORM_DESKTOP_GLFW
This commit is contained in:
@ -1248,12 +1248,13 @@ void PollInputEvents(void)
|
||||
|
||||
CORE.Window.resizedLastFrame = false;
|
||||
|
||||
if (CORE.Window.eventWaiting) glfwWaitEvents(); // Wait for in input events before continue (drawing is paused)
|
||||
if ((CORE.Window.eventWaiting) || (IsWindowState(FLAG_WINDOW_MINIMIZED) && !IsWindowState(FLAG_WINDOW_ALWAYS_RUN)))
|
||||
{
|
||||
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
|
||||
|
||||
// While window minimized, stop loop execution
|
||||
while (IsWindowState(FLAG_WINDOW_MINIMIZED) && !IsWindowState(FLAG_WINDOW_ALWAYS_RUN)) glfwWaitEvents();
|
||||
|
||||
CORE.Window.shouldClose = glfwWindowShouldClose(platform.handle);
|
||||
|
||||
// Reset close status for next frame
|
||||
@ -1739,12 +1740,7 @@ static void WindowContentScaleCallback(GLFWwindow *window, float scalex, float s
|
||||
static void WindowIconifyCallback(GLFWwindow *window, int iconified)
|
||||
{
|
||||
if (iconified) CORE.Window.flags |= FLAG_WINDOW_MINIMIZED; // The window was iconified
|
||||
else
|
||||
{
|
||||
CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // The window was restored
|
||||
|
||||
if ((CORE.Window.flags & FLAG_WINDOW_ALWAYS_RUN) == 0) CORE.Time.previous = GetTime();
|
||||
}
|
||||
else CORE.Window.flags &= ~FLAG_WINDOW_MINIMIZED; // The window was restored
|
||||
}
|
||||
|
||||
// GLFW3 WindowMaximize Callback, runs when window is maximized/restored
|
||||
|
||||
Reference in New Issue
Block a user