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/openglsdl | |
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/openglsdl')
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 26 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.h | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index 2710b66ecd..c71b9c9219 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -28,8 +28,8 @@ #include "common/translation.h" #endif -OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint desktopHeight, SdlEventSource *eventSource) - : SdlGraphicsManager(eventSource), _lastRequestedHeight(0), +OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(uint desktopWidth, uint desktopHeight, SdlEventSource *eventSource, SdlWindow *window) + : SdlGraphicsManager(eventSource, window), _lastRequestedHeight(0), #if SDL_VERSION_ATLEAST(2, 0, 0) _glContext(), #else @@ -134,7 +134,7 @@ void OpenGLSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) case OSystem::kFeatureIconifyWindow: if (enable) { - iconifyWindow(); + _window->iconifyWindow(); } break; @@ -148,7 +148,7 @@ bool OpenGLSdlGraphicsManager::getFeatureState(OSystem::Feature f) { case OSystem::kFeatureFullscreenMode: #if SDL_VERSION_ATLEAST(2, 0, 0) if (_window) { - return (SDL_GetWindowFlags(_window) & SDL_WINDOW_FULLSCREEN) != 0; + return (SDL_GetWindowFlags(_window->getSDLWindow()) & SDL_WINDOW_FULLSCREEN) != 0; } else { return _wantsFullScreen; } @@ -236,7 +236,7 @@ void OpenGLSdlGraphicsManager::updateScreen() { // Swap OpenGL buffers #if SDL_VERSION_ATLEAST(2, 0, 0) - SDL_GL_SwapWindow(_window); + SDL_GL_SwapWindow(_window->getSDLWindow()); #else SDL_GL_SwapBuffers(); #endif @@ -271,7 +271,7 @@ void OpenGLSdlGraphicsManager::notifyMousePos(Common::Point mouse) { } void OpenGLSdlGraphicsManager::setInternalMousePosition(int x, int y) { - warpMouseInWindow(x, y); + _window->warpMouseInWindow(x, y); } bool OpenGLSdlGraphicsManager::loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format) { @@ -362,7 +362,7 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) { _glContext = nullptr; } - destroyWindow(); + _window->destroyWindow(); uint32 flags = SDL_WINDOW_OPENGL; if (_wantsFullScreen) { @@ -371,26 +371,26 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) { flags |= SDL_WINDOW_RESIZABLE; } - if (!createWindow(width, height, flags)) { + if (!_window->createWindow(width, height, flags)) { // We treat fullscreen requests as a "hint" for now. This means in // case it is not available we simply ignore it. if (_wantsFullScreen) { - createWindow(width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); + _window->createWindow(width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); } - if (!_window) { + if (!_window->getSDLWindow()) { return false; } } - _glContext = SDL_GL_CreateContext(_window); + _glContext = SDL_GL_CreateContext(_window->getSDLWindow()); if (!_glContext) { return false; } notifyContextCreate(rgba8888, rgba8888); int actualWidth, actualHeight; - SDL_GetWindowSize(_window, &actualWidth, &actualHeight); + getWindowDimensions(&actualWidth, &actualHeight); setActualScreenSize(actualWidth, actualHeight); return true; #else @@ -451,7 +451,7 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) { void OpenGLSdlGraphicsManager::getWindowDimensions(int *width, int *height) { #if SDL_VERSION_ATLEAST(2, 0, 0) - SDL_GetWindowSize(_window, width, height); + SDL_GetWindowSize(_window->getSDLWindow(), width, height); #else if (width) { *width = _hwScreen->w; diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index 1e927df766..845880eb14 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -32,7 +32,7 @@ class OpenGLSdlGraphicsManager : public OpenGL::OpenGLGraphicsManager, public SdlGraphicsManager, public Common::EventObserver { public: - OpenGLSdlGraphicsManager(uint desktopWidth, uint desktopHeight, SdlEventSource *eventSource); + OpenGLSdlGraphicsManager(uint desktopWidth, uint desktopHeight, SdlEventSource *eventSource, SdlWindow *window); virtual ~OpenGLSdlGraphicsManager(); // GraphicsManager API |