diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-01-28 14:30:10 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-02-09 23:45:11 +0100 |
commit | 8aeb42b16430c85e4bc4052d881b8335d4a2ff36 (patch) | |
tree | b2c3deb9a722bcff49192578995ae7182a711cda /src/graphics.h | |
parent | 011f69af465085bd8555737a3297f0e070040128 (diff) | |
download | mana-8aeb42b16430c85e4bc4052d881b8335d4a2ff36.tar.gz mana-8aeb42b16430c85e4bc4052d881b8335d4a2ff36.tar.bz2 mana-8aeb42b16430c85e4bc4052d881b8335d4a2ff36.tar.xz mana-8aeb42b16430c85e4bc4052d881b8335d4a2ff36.zip |
Allow changing fullscreen resolution without restart
Unified Graphics:setFullscreen and Graphics:resize into a single
Graphics:changeVideoMode function that tries to restore the existing mode when
changing to the new mode didn't work, and exists with an error when that also
fails.
Split up handling of SDL_VIDEORESIZE and the adapting to new resolution in the
Client class, so that the second part could also be called when changing
resolution fullscreen mode.
The Video tab in the Setup window now also filters out any modes smaller than
640x480 since the game won't properly adapt to that resolution anyway.
Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/graphics.h')
-rw-r--r-- | src/graphics.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/graphics.h b/src/graphics.h index 4371e909..6a17aab4 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -88,14 +88,10 @@ class Graphics : public gcn::SDLGraphics virtual bool setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel); /** - * Set fullscreen mode. + * Change the video mode. Can be used for switching to full screen, + * changing resolution or adapting after window resize. */ - bool setFullscreen(bool fs); - - /** - * Resize the window to the specified size. - */ - bool resize(int width, int height); + bool changeVideoMode(int w, int h, int bpp, bool fs, bool hwaccel); /** * Blits an image onto the screen. @@ -122,7 +118,7 @@ class Graphics : public gcn::SDLGraphics dstX, dstY, width, height, desiredWidth, desiredHeight, - false); }; + false); } /** * Draws a resclaled version of the image @@ -209,6 +205,23 @@ class Graphics : public gcn::SDLGraphics int getHeight() const; /** + * Returns the amount of bits per pixel that was requested (not the + * actual amount that's currently active). + */ + int getBpp() const { return mBpp; } + + /** + * Returns whether we're in a full screen mode. + */ + bool getFullscreen() const { return mFullscreen; } + + /** + * Returns whether old-fashioned SDL-based hardware acceleration was + * requested (not whether it's currently active). + */ + bool getHWAccel() const { return mHWAccel; } + + /** * Takes a screenshot and returns it as SDL surface. */ virtual SDL_Surface *getScreenshot(); |