From cadd4e5c2ba119a2470cefed87f2aaba720d11f7 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 6 Mar 2021 13:36:20 +0100 Subject: [PATCH] sys: Lower down FPS to 5 when ImHex loses focus #189 --- source/window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/window.cpp b/source/window.cpp index 92f39bfa4..34df0803a 100644 --- a/source/window.cpp +++ b/source/window.cpp @@ -390,7 +390,7 @@ namespace hex { glfwSwapBuffers(this->m_window); - while (glfwGetTime() < this->m_lastFrameTime + (1 / this->m_targetFps)) + while (glfwGetTime() < this->m_lastFrameTime + 1 / (ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow) ? this->m_targetFps : 5.0)) std::this_thread::sleep_for(500us); this->m_lastFrameTime = glfwGetTime(); }