Skip to content

Commit 87d63c7

Browse files
authored
Merge pull request #47 from ryuukk/minimize
Do not render anything when window is minimized
2 parents df9f3be + 3d842fd commit 87d63c7

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

engine/system/win/sys_local.h

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class sys_main_c: public sys_IMain {
6060
class core_IMain* core = nullptr;
6161

6262
bool initialised = false;
63+
bool minimized = false;
6364
volatile bool exitFlag = false;
6465
volatile bool restartFlag = false;
6566
char* exitMsg = nullptr;

engine/system/win/sys_main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,8 @@ bool sys_main_c::Run(int argc, char** argv)
848848
Exit();
849849
break;
850850
}
851-
852-
core->Frame();
851+
if (minimized == false)
852+
core->Frame();
853853

854854
if (threadError) {
855855
Error(threadError);

engine/system/win/sys_video.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,10 @@ int sys_video_c::Apply(sys_vidSet_s* set)
426426
auto sys = (sys_main_c*)glfwGetWindowUserPointer(wnd);
427427
glfwSetWindowShouldClose(wnd, sys->initialised && sys->core->CanExit());
428428
});
429+
glfwSetWindowIconifyCallback(wnd, [](GLFWwindow* wnd, int value) {
430+
auto sys = (sys_main_c*)glfwGetWindowUserPointer(wnd);
431+
sys->minimized = value == 1 ? true : false;
432+
});
429433
glfwSetFramebufferSizeCallback(wnd, [](GLFWwindow* wnd, int width, int height) {
430434
auto sys = (sys_main_c*)glfwGetWindowUserPointer(wnd);
431435
sys->video->FramebufferSizeChanged(width, height);

0 commit comments

Comments
 (0)