summaryrefslogtreecommitdiff
path: root/src/render/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/render/graphics.cpp')
-rw-r--r--src/render/graphics.cpp25
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