summaryrefslogtreecommitdiff
path: root/src/graphics.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-14 20:58:26 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-05-14 20:58:26 +0000
commit0632377e8b2e63f965b30ac89a9e2dca819735ef (patch)
tree522477ab24f80baa393e0f9ecece14062483c810 /src/graphics.cpp
parent8381ec4111505692a9058db37412adb872bedd3e (diff)
downloadmana-0632377e8b2e63f965b30ac89a9e2dca819735ef.tar.gz
mana-0632377e8b2e63f965b30ac89a9e2dca819735ef.tar.bz2
mana-0632377e8b2e63f965b30ac89a9e2dca819735ef.tar.xz
mana-0632377e8b2e63f965b30ac89a9e2dca819735ef.zip
Added framerate limiter, off by default (0 means no limit)
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r--src/graphics.cpp9
1 files changed, 9 insertions, 0 deletions
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);
+ }
}