diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-01-30 17:03:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-01-30 19:53:08 +0300 |
commit | c2351483dc7c918a592f2a1f52745c6552fb7d0c (patch) | |
tree | 3bea6a36d7133b32bb67b037aad115b7785e6550 /src/graphics.cpp | |
parent | 8e244c7e5b6c98b1a6e67d4e387a9c231a42b15c (diff) | |
download | plus-c2351483dc7c918a592f2a1f52745c6552fb7d0c.tar.gz plus-c2351483dc7c918a592f2a1f52745c6552fb7d0c.tar.bz2 plus-c2351483dc7c918a592f2a1f52745c6552fb7d0c.tar.xz plus-c2351483dc7c918a592f2a1f52745c6552fb7d0c.zip |
Add option for enable/disable window resize.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r-- | src/graphics.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp index 46433639e..30aece5dc 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -47,13 +47,14 @@ Graphics::Graphics(): mBlitMode(BLIT_NORMAL), mRedraw(false), mDoubleBuffer(false), - mSecure(false) + mSecure(false), + mOpenGL(0), + mEnableResize(false) { mRect.x = 0; mRect.y = 0; mRect.w = 0; mRect.h = 0; - mOpenGL = 0; } Graphics::~Graphics() @@ -61,7 +62,8 @@ Graphics::~Graphics() _endDraw(); } -bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) +bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, + bool hwaccel, bool resize) { logger->log("Setting video mode %dx%d %s", w, h, fs ? "fullscreen" : "windowed"); @@ -73,10 +75,11 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) mBpp = bpp; mFullscreen = fs; mHWAccel = hwaccel; + mEnableResize = resize; if (fs) displayFlags |= SDL_FULLSCREEN; - else + else if (resize) displayFlags |= SDL_RESIZABLE; if (hwaccel) @@ -140,10 +143,10 @@ bool Graphics::setFullscreen(bool fs) if (mFullscreen == fs) return true; - return setVideoMode(mWidth, mHeight, mBpp, fs, mHWAccel); + return setVideoMode(mWidth, mHeight, mBpp, fs, mHWAccel, mEnableResize); } -bool Graphics::resize(int width, int height) +bool Graphics::resizeScreen(int width, int height) { if (mWidth == width && mHeight == height) return true; @@ -153,14 +156,18 @@ bool Graphics::resize(int width, int height) _endDraw(); - bool success = setVideoMode(width, height, mBpp, mFullscreen, mHWAccel); + bool success = setVideoMode(width, height, mBpp, + mFullscreen, mHWAccel, mEnableResize); // If it didn't work, try to restore the previous size. If that didn't // work either, bail out (but then we're in deep trouble). if (!success) { - if (!setVideoMode(prevWidth, prevHeight, mBpp, mFullscreen, mHWAccel)) + if (!setVideoMode(prevWidth, prevHeight, mBpp, + mFullscreen, mHWAccel, mEnableResize)) + { return false; + } } _beginDraw(); |