diff options
author | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-07-17 22:29:16 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> | 2012-07-17 22:31:33 +0200 |
commit | 7111ae12125eb810d396045417558769e73a7fb7 (patch) | |
tree | f3edbcf7d8d1629b94750f235d13b8a14a9b08fe | |
parent | 7b434e1b18a1425173fcf0b0476a4822082c7028 (diff) | |
download | mana-client-7111ae12125eb810d396045417558769e73a7fb7.tar.gz mana-client-7111ae12125eb810d396045417558769e73a7fb7.tar.bz2 mana-client-7111ae12125eb810d396045417558769e73a7fb7.tar.xz mana-client-7111ae12125eb810d396045417558769e73a7fb7.zip |
Fill the window also in software rendering mode
Mouse handling is broken when the game only fills a subset of the screen,
and this doesn't look very nice either. Do the same as done in OpenGL
mode for now.
-rw-r--r-- | src/graphics.cpp | 16 | ||||
-rw-r--r-- | src/openglgraphics.cpp | 1 |
2 files changed, 9 insertions, 8 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp index 553f33ab..d36d2fa7 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -72,19 +72,21 @@ bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) SDL_FreeSurface(mTarget); mTarget = 0; + // Calculate scaling factor + mScale = std::max(w / 640, h / 360); + mScreenSurface = SDL_SetVideoMode(w, h, bpp, displayFlags); const SDL_PixelFormat& fmt = *(mScreenSurface->format); - setTarget(SDL_CreateRGBSurface(SDL_SWSURFACE, 640, 360, fmt.BitsPerPixel, fmt.Rmask, fmt.Gmask, fmt.Bmask, 0)); + setTarget(SDL_CreateRGBSurface(SDL_SWSURFACE, + w / mScale, h / mScale, + fmt.BitsPerPixel, + fmt.Rmask, fmt.Gmask, fmt.Bmask, 0)); if (!mTarget) return false; - mWidth = 640; - mHeight = 360; - - // Calculate scaling factor - mScale = std::min(w / 640, h / 360); - + mWidth = mTarget->w; + mHeight = mTarget->h; mBpp = bpp; mFullscreen = fs; mHWAccel = hwaccel; diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 14c32a95..65e24e51 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -74,7 +74,6 @@ bool OpenGLGraphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) const double targetRatio = (double) 640 / 360; // 1.77778 const double requestedRatio = (double) w / h; - mScale = 1; if (requestedRatio < targetRatio) { // Screen is higher / narrower than target aspect ratio: calculate |