summaryrefslogtreecommitdiff
path: root/src/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/render')
-rw-r--r--src/render/graphics.cpp25
-rw-r--r--src/render/graphics.h4
-rw-r--r--src/render/openglgraphicsdef.hpp2
3 files changed, 26 insertions, 5 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
diff --git a/src/render/graphics.h b/src/render/graphics.h
index adf1b97c4..0cb510195 100644
--- a/src/render/graphics.h
+++ b/src/render/graphics.h
@@ -348,9 +348,11 @@ class Graphics : public gcn::Graphics
int getScale() const
{ return mScale; }
- virtual bool allowScale() const
+ virtual bool isAllowScale() const
{ return false; }
+ void setScale(int scale);
+
int mWidth;
int mHeight;
int mActualWidth;
diff --git a/src/render/openglgraphicsdef.hpp b/src/render/openglgraphicsdef.hpp
index 6654254cb..89f8e63a9 100644
--- a/src/render/openglgraphicsdef.hpp
+++ b/src/render/openglgraphicsdef.hpp
@@ -142,7 +142,7 @@
void completeCache() override final;
- bool allowScale() const override final
+ bool isAllowScale() const override final
{ return true; }
static void bindTexture(const GLenum target, const GLuint texture);