From 0632377e8b2e63f965b30ac89a9e2dca819735ef Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sat, 14 May 2005 20:58:26 +0000 Subject: Added framerate limiter, off by default (0 means no limit) --- src/graphics.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/graphics.cpp') diff --git a/src/graphics.cpp b/src/graphics.cpp index 7da5520c..94c23704 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -148,4 +148,13 @@ void Graphics::updateScreen() else { SDL_Flip(screen); } + + // Decrement frame counter when using framerate limiting + if (framesToDraw > 1) framesToDraw--; + + // Wait while we're not allowed to draw next frame yet + while (framesToDraw == 1) + { + SDL_Delay(10); + } } -- cgit v1.2.3-70-g09d2