* Call SDL_Delay(1) when out of focus (to explicitly yield our CPU time to prevent hogging the CPU)

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1604 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2007-05-10 09:34:17 +00:00
parent b8a986228b
commit bc9cc26f3d
1 changed files with 7 additions and 1 deletions

View File

@ -26,6 +26,7 @@
#include "lib/framework/frame.h"
#include <SDL/SDL_main.h>
#include <SDL/SDL_timer.h>
#include <physfs.h>
/* For SHGetFolderPath */
@ -697,7 +698,12 @@ int main(int argc, char *argv[])
}
gameTimeUpdate();
} // !paused && !quit
} // !lostFocus && !quit
else if (lostFocus && !quit)
{
// Prevent CPU hogging when we've lost focus
SDL_Delay(1);
}
} // End of !Restart loop.
debug(LOG_MAIN, "Preparing for shutdown/restart");