diff --git a/engine/system/win/sys_local.h b/engine/system/win/sys_local.h index 07d2f23..a51bec4 100644 --- a/engine/system/win/sys_local.h +++ b/engine/system/win/sys_local.h @@ -60,6 +60,7 @@ class sys_main_c: public sys_IMain { class core_IMain* core = nullptr; bool initialised = false; + bool minimized = false; volatile bool exitFlag = false; volatile bool restartFlag = false; char* exitMsg = nullptr; diff --git a/engine/system/win/sys_main.cpp b/engine/system/win/sys_main.cpp index 6634a56..3a01cdd 100644 --- a/engine/system/win/sys_main.cpp +++ b/engine/system/win/sys_main.cpp @@ -848,8 +848,8 @@ bool sys_main_c::Run(int argc, char** argv) Exit(); break; } - - core->Frame(); + if (minimized == false) + core->Frame(); if (threadError) { Error(threadError); diff --git a/engine/system/win/sys_video.cpp b/engine/system/win/sys_video.cpp index 04ff3bd..705011f 100644 --- a/engine/system/win/sys_video.cpp +++ b/engine/system/win/sys_video.cpp @@ -426,6 +426,10 @@ int sys_video_c::Apply(sys_vidSet_s* set) auto sys = (sys_main_c*)glfwGetWindowUserPointer(wnd); glfwSetWindowShouldClose(wnd, sys->initialised && sys->core->CanExit()); }); + glfwSetWindowIconifyCallback(wnd, [](GLFWwindow* wnd, int value) { + auto sys = (sys_main_c*)glfwGetWindowUserPointer(wnd); + sys->minimized = value == 1 ? true : false; + }); glfwSetFramebufferSizeCallback(wnd, [](GLFWwindow* wnd, int width, int height) { auto sys = (sys_main_c*)glfwGetWindowUserPointer(wnd); sys->video->FramebufferSizeChanged(width, height);