X-Git-Url: https://git.ucc.asn.au/?p=progcomp2012.git;a=blobdiff_plain;f=judge%2Fmanager%2Fgame.cpp;h=c1238f0660104b9b09326f970382badd105130cf;hp=0e768c5fe60333b099c4b072738f6315c29db91f;hb=f37d392713a0b6fec7a2c543edcd8402156f3744;hpb=5f9adddd695f2664a0d690b59a779e40b51ade3d diff --git a/judge/manager/game.cpp b/judge/manager/game.cpp index 0e768c5..c1238f0 100644 --- a/judge/manager/game.cpp +++ b/judge/manager/game.cpp @@ -208,21 +208,23 @@ void Game::Wait(double wait) if (wait <= 0) return; - TimerThread timer(wait*1000000); //Wait in seconds - timer.Start(); + + #ifdef BUILD_GRAPHICS + + if (!graphicsEnabled) { - while (!timer.Finished()); - timer.Stop(); + usleep(1000000*wait); //Wait in seconds return; } - #endif //BUILD_GRAPHICS + TimerThread timer(wait*1000000); //Wait in seconds + timer.Start(); while (!timer.Finished()) { - #ifdef BUILD_GRAPHICS + SDL_Event event; while (SDL_PollEvent(&event)) { @@ -234,9 +236,12 @@ void Game::Wait(double wait) break; } } - #endif //BUILD_GRAPHICS } timer.Stop(); + + #else + usleep(wait*1000000); //Wait in seconds + #endif //BUILD_GRAPHICS }