Skip to content

Commit 61477ee

Browse files
authored
Merge pull request #53 from ryuukk/patch-4
Save ressources when window is minimized
2 parents c9e1865 + a5ed67d commit 61477ee

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

engine/system/win/sys_main.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,14 +842,18 @@ bool sys_main_c::Run(int argc, char** argv)
842842

843843
// Run frame loop
844844
while (exitFlag == false) {
845-
glfwPollEvents();
845+
if (minimized) {
846+
glfwWaitEventsTimeout(0.1);
847+
}
848+
else {
849+
glfwPollEvents();
850+
}
846851
auto wnd = (GLFWwindow*)video->GetWindowHandle();
847852
if (glfwWindowShouldClose(wnd)) {
848853
Exit();
849854
break;
850855
}
851-
if (minimized == false)
852-
core->Frame();
856+
core->Frame();
853857

854858
if (threadError) {
855859
Error(threadError);

0 commit comments

Comments
 (0)