diff options
author | Johannes Schickel | 2015-02-16 00:49:42 +0100 |
---|---|---|
committer | Johannes Schickel | 2015-02-16 01:03:29 +0100 |
commit | 627d766325e1d435816648f85dbf9c007269b3f2 (patch) | |
tree | 795ea66fd2755e81c7d060ee250fd6f53cf20ade /backends/graphics/surfacesdl | |
parent | b00050439f0f602cb54500f7fda268a7589b4c8b (diff) | |
download | scummvm-rg350-627d766325e1d435816648f85dbf9c007269b3f2.tar.gz scummvm-rg350-627d766325e1d435816648f85dbf9c007269b3f2.tar.bz2 scummvm-rg350-627d766325e1d435816648f85dbf9c007269b3f2.zip |
SDL: Add basic abstraction class for the SDL window.
Diffstat (limited to 'backends/graphics/surfacesdl')
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 18 | ||||
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.h | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 8e349653d0..d08925349a 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -116,9 +116,9 @@ static AspectRatio getDesiredAspectRatio() { } #endif -SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource) +SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window) : - SdlGraphicsManager(sdlEventSource), + SdlGraphicsManager(sdlEventSource, window), #ifdef USE_OSD _osdSurface(0), _osdAlpha(SDL_ALPHA_TRANSPARENT), _osdFadeStartTime(0), #endif @@ -239,7 +239,7 @@ void SurfaceSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) break; case OSystem::kFeatureIconifyWindow: if (enable) - iconifyWindow(); + _window->iconifyWindow(); break; default: break; @@ -1742,7 +1742,7 @@ void SurfaceSdlGraphicsManager::warpMouse(int x, int y) { int y1 = y; // Don't change actual mouse position, when mouse is outside of our window (in case of windowed mode) - if (!hasMouseFocus()) { + if (!_window->hasMouseFocus()) { setMousePos(x, y); // but change game cursor position return; } @@ -1752,9 +1752,9 @@ void SurfaceSdlGraphicsManager::warpMouse(int x, int y) { if (_mouseCurState.x != x || _mouseCurState.y != y) { if (!_overlayVisible) - warpMouseInWindow(x * _videoMode.scaleFactor, y1 * _videoMode.scaleFactor); + _window->warpMouseInWindow(x * _videoMode.scaleFactor, y1 * _videoMode.scaleFactor); else - warpMouseInWindow(x, y1); + _window->warpMouseInWindow(x, y1); // SDL_WarpMouse() generates a mouse movement event, so // setMousePos() would be called eventually. However, the @@ -2357,17 +2357,17 @@ void SurfaceSdlGraphicsManager::deinitializeRenderer() { SDL_DestroyRenderer(_renderer); _renderer = nullptr; - destroyWindow(); + _window->destroyWindow(); } SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) { deinitializeRenderer(); - if (!createWindow(width, height, (flags & SDL_FULLSCREEN) ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0)) { + if (!_window->createWindow(width, height, (flags & SDL_FULLSCREEN) ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0)) { return nullptr; } - _renderer = SDL_CreateRenderer(_window, -1, 0); + _renderer = SDL_CreateRenderer(_window->getSDLWindow(), -1, 0); if (!_renderer) { deinitializeRenderer(); return nullptr; diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h index c4227475c0..4ba15a304b 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h @@ -77,7 +77,7 @@ public: */ class SurfaceSdlGraphicsManager : public SdlGraphicsManager, public Common::EventObserver { public: - SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource); + SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window); virtual ~SurfaceSdlGraphicsManager(); virtual void activateManager(); |