diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-29 00:55:06 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-29 00:55:06 +0300 |
commit | dbc30204cae020ff0be41fb8f20bbb3a531686b3 (patch) | |
tree | 844ffa7b47c576ca93631020665a92af08603c25 /src/render/graphics.cpp | |
parent | b9b358dc0d5c268a923c3a961ac8c072ccc691cf (diff) | |
download | manaverse-dbc30204cae020ff0be41fb8f20bbb3a531686b3.tar.gz manaverse-dbc30204cae020ff0be41fb8f20bbb3a531686b3.tar.bz2 manaverse-dbc30204cae020ff0be41fb8f20bbb3a531686b3.tar.xz manaverse-dbc30204cae020ff0be41fb8f20bbb3a531686b3.zip |
allow apply scale without client restart.
Diffstat (limited to 'src/render/graphics.cpp')
-rw-r--r-- | src/render/graphics.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/render/graphics.cpp b/src/render/graphics.cpp index 27682f1f0..82f44460b 100644 --- a/src/render/graphics.cpp +++ b/src/render/graphics.cpp @@ -120,16 +120,35 @@ void Graphics::setMainFlags(const int w, const int h, logger->log("Setting video mode %dx%d %s", w, h, fs ? "fullscreen" : "windowed"); - mWidth = w / scale; - mHeight = h / scale; mBpp = bpp; mFullscreen = fs; mHWAccel = hwaccel; mEnableResize = resize; mNoFrame = noFrame; - mScale = scale; mActualWidth = w; mActualHeight = h; + setScale(scale); +} + +void Graphics::setScale(int scale) +{ + if (isAllowScale()) + { + if (!scale) + scale = 1; + if (mActualWidth / scale < 470 || mActualHeight / scale < 320) + scale = 1; + logger->log("set scale: %d", scale); + mScale = scale; + } + else + { + mScale = 1; + } + mWidth = mActualWidth / mScale; + mHeight = mActualHeight / mScale; + mRect.w = mWidth; + mRect.h = mHeight; } int Graphics::getOpenGLFlags() const |