summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/game.cpp18
2 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 135820f0..40cca7e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
- Dialogs are now modal when appropriate
- Fixed a crash in OpenGL mode
- Fixed rendering of minimap, progress bars and player sprite in OpenGL mode
+- Fixed 100% CPU usage when minimized
0.0.12 (1 May 2005)
- Added new map (a cave), tiles, monsters and items
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;
}