diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-02-21 23:58:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-02-21 23:58:54 +0300 |
commit | 826ead0896ab8d47ec032627e39874c859260736 (patch) | |
tree | cbf9272934382f287fe3acbe51ad80bcb97ec405 /src/client.cpp | |
parent | df1e9664e176377cb8f9501d1b828ee42cd8e8f8 (diff) | |
download | mv-826ead0896ab8d47ec032627e39874c859260736.tar.gz mv-826ead0896ab8d47ec032627e39874c859260736.tar.bz2 mv-826ead0896ab8d47ec032627e39874c859260736.tar.xz mv-826ead0896ab8d47ec032627e39874c859260736.zip |
Add vsync option.
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp index b853f1908..242bb2f21 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -564,6 +564,7 @@ void Client::gameInit() applyGrabMode(); applyGamma(); + applyVSync(); // Initialize for drawing mainGraphics->_beginDraw(); @@ -668,6 +669,7 @@ void Client::gameInit() config.addListener("guialpha", this); config.addListener("gamma", this); config.addListener("particleEmitterSkip", this); + config.addListener("vsync", this); setGuiAlpha(config.getFloatValue("guialpha")); optionChanged("fpslimit"); @@ -709,6 +711,7 @@ void Client::gameClear() config.removeListener("guialpha", this); config.removeListener("gamma", this); config.removeListener("particleEmitterSkip", this); + config.removeListener("vsync", this); SDL_RemoveTimer(mLogicCounterId); SDL_RemoveTimer(mSecondsCounterId); @@ -1507,6 +1510,10 @@ void Client::optionChanged(const std::string &name) { Particle::emitterSkip = config.getIntValue("particleEmitterSkip") + 1; } + else if (name == "vsync") + { + applyVSync(); + } } void Client::action(const gcn::ActionEvent &event) @@ -2457,3 +2464,10 @@ void Client::applyGamma() float val = config.getFloatValue("gamma"); SDL_SetGamma(val, val, val); } + +void Client::applyVSync() +{ + int val = config.getIntValue("vsync"); + if (val > 0 && val < 2) + SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, val); +} |