Stop render when iconified
This commit is contained in:
+9
-3
@@ -109,10 +109,16 @@ void Engine::mainloop() {
|
|||||||
|
|
||||||
gui->act(delta);
|
gui->act(delta);
|
||||||
screen->update(delta);
|
screen->update(delta);
|
||||||
screen->draw(delta);
|
|
||||||
gui->draw(&batch, assets.get());
|
|
||||||
|
|
||||||
Window::swapInterval(settings.display.swapInterval);
|
if (!Window::isIconified()) {
|
||||||
|
screen->draw(delta);
|
||||||
|
gui->draw(&batch, assets.get());
|
||||||
|
Window::swapInterval(settings.display.swapInterval);
|
||||||
|
} else {
|
||||||
|
Window::swapInterval(1);
|
||||||
|
Window::swapBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
Window::swapBuffers();
|
Window::swapBuffers();
|
||||||
Events::pollEvents();
|
Events::pollEvents();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ bool Window::isMaximized() {
|
|||||||
return glfwGetWindowAttrib(window, GLFW_MAXIMIZED);
|
return glfwGetWindowAttrib(window, GLFW_MAXIMIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Window::isIconified() {
|
||||||
|
return glfwGetWindowAttrib(window, GLFW_ICONIFIED);
|
||||||
|
}
|
||||||
|
|
||||||
bool Window::isFocused()
|
bool Window::isFocused()
|
||||||
{
|
{
|
||||||
return glfwGetWindowAttrib(window, GLFW_FOCUSED);
|
return glfwGetWindowAttrib(window, GLFW_FOCUSED);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public:
|
|||||||
static bool isFullscreen();
|
static bool isFullscreen();
|
||||||
static bool isMaximized();
|
static bool isMaximized();
|
||||||
static bool isFocused();
|
static bool isFocused();
|
||||||
|
static bool isIconified();
|
||||||
|
|
||||||
static void pushScissor(glm::vec4 area);
|
static void pushScissor(glm::vec4 area);
|
||||||
static void popScissor();
|
static void popScissor();
|
||||||
|
|||||||
Reference in New Issue
Block a user