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 /src/graphics.cpp | |
parent | 7b434e1b18a1425173fcf0b0476a4822082c7028 (diff) | |
download | mana-7111ae12125eb810d396045417558769e73a7fb7.tar.gz mana-7111ae12125eb810d396045417558769e73a7fb7.tar.bz2 mana-7111ae12125eb810d396045417558769e73a7fb7.tar.xz mana-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.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r-- | src/graphics.cpp | 16 |
1 files changed, 9 insertions, 7 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; |