From 31f6125fc7253e278bba5db46e08f370d92717c7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 21 Aug 2013 14:52:03 +0300 Subject: move sdl video mode initialisation from graphics into sdlgraphics. --- src/graphics.cpp | 15 --------------- src/graphics.h | 2 +- src/sdlgraphics.cpp | 15 +++++++++++++++ src/sdlgraphics.h | 4 ++++ 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/graphics.cpp b/src/graphics.cpp index 51c2c4a24..09ea4d880 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -256,21 +256,6 @@ int Graphics::getMemoryUsage() const return 0; } -bool Graphics::setVideoMode(const int w, const int h, const int bpp, - const bool fs, const bool hwaccel, - const bool resize, const bool noFrame) -{ - setMainFlags(w, h, bpp, fs, hwaccel, resize, noFrame); - - if (!(mTarget = SDL_SetVideoMode(w, h, bpp, getSoftwareFlags()))) - return false; - - mRect.w = static_cast(mTarget->w); - mRect.h = static_cast(mTarget->h); - - return videoInfo(); -} - bool Graphics::videoInfo() { char videoDriverName[65]; diff --git a/src/graphics.h b/src/graphics.h index 6d46a1392..9365af4ec 100644 --- a/src/graphics.h +++ b/src/graphics.h @@ -122,7 +122,7 @@ class Graphics : public gcn::Graphics */ virtual bool setVideoMode(const int w, const int h, const int bpp, const bool fs, const bool hwaccel, - const bool resize, const bool noFrame); + const bool resize, const bool noFrame) = 0; /** * Set fullscreen mode. diff --git a/src/sdlgraphics.cpp b/src/sdlgraphics.cpp index 704f51f3a..b78efeda6 100644 --- a/src/sdlgraphics.cpp +++ b/src/sdlgraphics.cpp @@ -1129,3 +1129,18 @@ void SDLGraphics::drawLine(int x1, int y1, int x2, int y2) // other cases not implimented } + +bool SDLGraphics::setVideoMode(const int w, const int h, const int bpp, + const bool fs, const bool hwaccel, + const bool resize, const bool noFrame) +{ + setMainFlags(w, h, bpp, fs, hwaccel, resize, noFrame); + + if (!(mTarget = SDL_SetVideoMode(w, h, bpp, getSoftwareFlags()))) + return false; + + mRect.w = static_cast(mTarget->w); + mRect.h = static_cast(mTarget->h); + + return videoInfo(); +} diff --git a/src/sdlgraphics.h b/src/sdlgraphics.h index 0d078fdce..18a03a46a 100644 --- a/src/sdlgraphics.h +++ b/src/sdlgraphics.h @@ -137,6 +137,10 @@ class SDLGraphics : public Graphics void drawLine(int x1, int y1, int x2, int y2) override; + bool setVideoMode(const int w, const int h, const int bpp, + const bool fs, const bool hwaccel, + const bool resize, const bool noFrame); + protected: virtual bool drawImage2(const Image *const image, int srcX, int srcY, -- cgit v1.2.3-60-g2f50