Skip to content

Commit

Permalink
Merge pull request #47 from ryuukk/minimize
Browse files Browse the repository at this point in the history
Do not render anything when window is minimized
  • Loading branch information
Wires77 authored Mar 27, 2024
2 parents df9f3be + 3d842fd commit 87d63c7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions engine/system/win/sys_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions engine/system/win/sys_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions engine/system/win/sys_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 87d63c7

Please sign in to comment.