summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-20 21:28:20 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-20 21:28:20 +0000
commit77436e727119ae4d762d426efcd1d84748f9edea (patch)
tree534751bd903493faec75946e11bebdd563d00c92 /src/game.cpp
parent04da189810d74df40d6f92694bd8e0285c6d07ad (diff)
downloadmana-77436e727119ae4d762d426efcd1d84748f9edea.tar.gz
mana-77436e727119ae4d762d426efcd1d84748f9edea.tar.bz2
mana-77436e727119ae4d762d426efcd1d84748f9edea.tar.xz
mana-77436e727119ae4d762d426efcd1d84748f9edea.zip
Stop drawing frames when application isn't active (ie. minimized)
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 6bac6458..717567d1 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -131,14 +131,22 @@ void game()
{
do_input();
engine->logic();
+ gui->logic();
gameTime++;
}
+
gameTime = tick_time;
- // Draw next frame
- gui->logic();
- engine->draw();
- graphics->updateScreen();
+ // Update the screen when application is active, delay otherwise
+ if (SDL_GetAppState() & SDL_APPACTIVE)
+ {
+ engine->draw();
+ graphics->updateScreen();
+ }
+ else
+ {
+ SDL_Delay(10);
+ }
// Handle network stuff and flush it
do_parse();
@@ -296,7 +304,7 @@ void do_input()
buddyWindow->setVisible(!buddyWindow->isVisible());
used = true;
}
- else if (keysym.sym == SDLK_m) {
+ else if (keysym.sym == SDLK_m) {
menu->setVisible(!menu->isVisible());
used = true;
}