summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-03-19 23:05:20 -0600
committerIra Rice <irarice@gmail.com>2009-03-19 23:05:20 -0600
commit4b7755fcae0de15951c508ec034158007c8b6cf3 (patch)
treedf9cddb1231fc0812ac1d3910ab98762f554fbf3 /src/game.cpp
parentc2c0a9fa8476b9335a6198b41cc702da82fd40bd (diff)
downloadMana-4b7755fcae0de15951c508ec034158007c8b6cf3.tar.gz
Mana-4b7755fcae0de15951c508ec034158007c8b6cf3.tar.bz2
Mana-4b7755fcae0de15951c508ec034158007c8b6cf3.tar.xz
Mana-4b7755fcae0de15951c508ec034158007c8b6cf3.zip
Throttle framerates down to save CPU cycles. Now that we're getting high
framerates in OpenGL even on older hardware, this should be done to conserve on CPU usage, rather than stressing it with more frames than the monitor can render. Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp
index a346616f..7f0186d1 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -408,8 +408,11 @@ void Game::optionChanged(const std::string &name)
{
int fpsLimit = (int) config.getValue("fpslimit", 0);
- // Calculate new minimum frame time
- mMinFrameTime = fpsLimit ? 1000 / fpsLimit : 0;
+ // Calculate new minimum frame time. If one isn't set, use 60 FPS.
+ // (1000 / 60 is 16.66) Since the client can go well above the refresh
+ // rates for monitors now in OpenGL mode, this cutoff is done to help
+ // conserve on CPU time.
+ mMinFrameTime = fpsLimit ? 1000 / fpsLimit : 16;
// Reset draw time to current time
mDrawTime = tick_time * 10;