From 8a23aa1bec70af96407963c9875bc276e57dcbf8 Mon Sep 17 00:00:00 2001 From: Alexander Overvoorde Date: Fri, 23 Oct 2015 17:33:21 +0200 Subject: [PATCH] Change openrct2_loop to not draw if window is minimized or otherwise hidden (fixes #2096) --- src/openrct2.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/openrct2.c b/src/openrct2.c index c446c4692a..04e9dca7c5 100644 --- a/src/openrct2.c +++ b/src/openrct2.c @@ -393,8 +393,11 @@ static void openrct2_loop() invalidate_sprite_2(&g_sprite_list[i]); } - rct2_draw(); - platform_draw(); + if ((SDL_GetWindowFlags(gWindow) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_HIDDEN)) == 0) { + rct2_draw(); + platform_draw(); + } + fps++; if (SDL_GetTicks() - secondTick >= 1000) { fps = 0; @@ -426,8 +429,10 @@ static void openrct2_loop() rct2_update(); - rct2_draw(); - platform_draw(); + if ((SDL_GetWindowFlags(gWindow) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_HIDDEN)) == 0) { + rct2_draw(); + platform_draw(); + } } } while (!_finished); }