diff --git a/src/engine/WindowControl.cpp b/src/engine/WindowControl.cpp index 637f4899..a44a410d 100644 --- a/src/engine/WindowControl.cpp +++ b/src/engine/WindowControl.cpp @@ -93,5 +93,5 @@ void WindowControl::nextFrame(bool waitForRefresh) { ); } window.swapBuffers(); - input.pollEvents(waitForRefresh); + input.pollEvents(waitForRefresh && !window.checkShouldRefresh()); } diff --git a/src/window/detail/GLFWWindow.cpp b/src/window/detail/GLFWWindow.cpp index 5fa8865f..a80c10e0 100644 --- a/src/window/detail/GLFWWindow.cpp +++ b/src/window/detail/GLFWWindow.cpp @@ -382,11 +382,11 @@ public: } void setShouldRefresh() override { - shouldRefresh = 2; + shouldRefresh = true; } bool checkShouldRefresh() override { - if ((--shouldRefresh) == 0) { + if (shouldRefresh) { shouldRefresh = false; return true; } @@ -573,7 +573,7 @@ private: double prevSwap = 0.0; int posX = 0; int posY = 0; - int shouldRefresh = 1; + bool shouldRefresh = true; }; static_assert(!std::is_abstract());