diff options
author | Alejandro Marzini | 2010-07-11 04:32:24 +0000 |
---|---|---|
committer | Alejandro Marzini | 2010-07-11 04:32:24 +0000 |
commit | 4dca7c7e02a111a950124ee26a6d46090a0f755c (patch) | |
tree | 0b5a39e1b03a0934392d1e982b4839c08b41daa9 | |
parent | 85034dc730148dab3eb85b47be3f3984337e9484 (diff) | |
download | scummvm-rg350-4dca7c7e02a111a950124ee26a6d46090a0f755c.tar.gz scummvm-rg350-4dca7c7e02a111a950124ee26a6d46090a0f755c.tar.bz2 scummvm-rg350-4dca7c7e02a111a950124ee26a6d46090a0f755c.zip |
Moved getGraphicsManager() from OSystem_SDL to ModularBackend. Moved public SDL graphics manager functions to graphics manager (Allowing OpenGLSdlGraphicsMaanger to be used with other SDL managers easily). Removed BaseSdlGraphicsManager. Implemented in the opengl manager basic screen functions.
svn-id: r50796
-rw-r--r-- | backends/events/sdl/sdl-events.cpp | 2 | ||||
-rw-r--r-- | backends/graphics/graphics.h | 36 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 146 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 47 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 58 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.h | 6 | ||||
-rw-r--r-- | backends/graphics/sdl/basesdl-graphics.h | 79 | ||||
-rw-r--r-- | backends/graphics/sdl/sdl-graphics.cpp | 17 | ||||
-rw-r--r-- | backends/graphics/sdl/sdl-graphics.h | 12 | ||||
-rw-r--r-- | backends/modular-backend.cpp | 5 | ||||
-rw-r--r-- | backends/modular-backend.h | 1 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 9 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.h | 6 |
13 files changed, 291 insertions, 133 deletions
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp index c66e45395b..96def04e25 100644 --- a/backends/events/sdl/sdl-events.cpp +++ b/backends/events/sdl/sdl-events.cpp @@ -324,7 +324,7 @@ bool SdlEventManager::handleKeyDown(SDL_Event &ev, Common::Event &event) { // Ctrl-Alt-<key> will change the GFX mode if ((event.kbd.flags & (Common::KBD_CTRL|Common::KBD_ALT)) == (Common::KBD_CTRL|Common::KBD_ALT)) { - if (((OSystem_SDL *) g_system)->getGraphicsManager()->handleScalerHotkeys(ev.key)) + if (((OSystem_SDL *) g_system)->getGraphicsManager()->handleScalerHotkeys((Common::KeyCode)ev.key.keysym.sym)) return false; } diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h index fd50631054..0ea425c9bc 100644 --- a/backends/graphics/graphics.h +++ b/backends/graphics/graphics.h @@ -28,6 +28,7 @@ #include "common/system.h" #include "common/noncopyable.h" +#include "common/keyboard.h" /** * Abstract class for graphics manager. Subclasses @@ -84,6 +85,41 @@ public: virtual void disableCursorPalette(bool disable) = 0; virtual void displayMessageOnOSD(const char *msg) {} + + /** + * Marks the screen for a full redraw + */ + virtual void forceFullRedraw() {}; + + /** + * Handles the scalar hotkeys + */ + virtual bool handleScalerHotkeys(Common::KeyCode key) { return false; }; + + /** + * Returns if the event passed is a hotkey for the graphics scalers + */ + virtual bool isScalerHotkey(const Common::Event &event) { return false; }; + + /** + * Adjusts mouse event coords for the current scaler + */ + virtual void adjustMouseEvent(Common::Event &event) {}; + + /** + * Updates the mouse cursor position + */ + virtual void setMousePos(int x, int y) {}; + + /** + * Toggles fullscreen + */ + virtual void toggleFullScreen() {}; + + /** + * Saves a screenshot to a file + */ + virtual bool saveScreenshot(const char *filename) { return false; }; }; #endif diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index fd3824b394..71f0213a50 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -28,7 +28,19 @@ OpenGLGraphicsManager::OpenGLGraphicsManager() : - _gameTexture(0), _overlayTexture(0), _mouseTexture(0) { + _gameTexture(0), _overlayTexture(0), _mouseTexture(0), + _screenChangeCount(0), + _transactionMode(0) + + { + + memset(&_oldVideoMode, 0, sizeof(_oldVideoMode)); + memset(&_videoMode, 0, sizeof(_videoMode)); + memset(&_transactionDetails, 0, sizeof(_transactionDetails)); + + _videoMode.mode = GFX_NORMAL; + _videoMode.scaleFactor = 1; + _videoMode.fullscreen = false; } OpenGLGraphicsManager::~OpenGLGraphicsManager() { @@ -93,7 +105,33 @@ Common::List<Graphics::PixelFormat> OpenGLGraphicsManager::getSupportedFormats() #endif void OpenGLGraphicsManager::initSize(uint width, uint height, const Graphics::PixelFormat *format) { + assert(_transactionMode == kTransactionActive); + +#ifdef USE_RGB_COLOR + //avoid redundant format changes + Graphics::PixelFormat newFormat; + if (!format) + newFormat = Graphics::PixelFormat::createFormatCLUT8(); + else + newFormat = *format; + + assert(newFormat.bytesPerPixel > 0); + + if (newFormat != _videoMode.format) { + _videoMode.format = newFormat; + _transactionDetails.formatChanged = true; + _screenFormat = newFormat; + } +#endif + + // Avoid redundant res changes + if ((int)width == _videoMode.screenWidth && (int)height == _videoMode.screenHeight) + return; + + _videoMode.screenWidth = width; + _videoMode.screenHeight = height; + _transactionDetails.sizeChanged = true; } int OpenGLGraphicsManager::getScreenChangeID() const { @@ -105,11 +143,107 @@ int OpenGLGraphicsManager::getScreenChangeID() const { // void OpenGLGraphicsManager::beginGFXTransaction() { + assert(_transactionMode == kTransactionNone); + _transactionMode = kTransactionActive; + _transactionDetails.sizeChanged = false; + _transactionDetails.needHotswap = false; + _transactionDetails.needUpdatescreen = false; +#ifdef USE_RGB_COLOR + _transactionDetails.formatChanged = false; +#endif + + _oldVideoMode = _videoMode; } OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() { - return OSystem::kTransactionSuccess; + int errors = OSystem::kTransactionSuccess; + + assert(_transactionMode != kTransactionNone); + + if (_transactionMode == kTransactionRollback) { + if (_videoMode.fullscreen != _oldVideoMode.fullscreen) { + errors |= OSystem::kTransactionFullscreenFailed; + + _videoMode.fullscreen = _oldVideoMode.fullscreen; + /*} else if (_videoMode.aspectRatioCorrection != _oldVideoMode.aspectRatioCorrection) { + errors |= OSystem::kTransactionAspectRatioFailed; + + _videoMode.aspectRatioCorrection = _oldVideoMode.aspectRatioCorrection;*/ + } else if (_videoMode.mode != _oldVideoMode.mode) { + errors |= OSystem::kTransactionModeSwitchFailed; + + _videoMode.mode = _oldVideoMode.mode; + _videoMode.scaleFactor = _oldVideoMode.scaleFactor; +#ifdef USE_RGB_COLOR + } else if (_videoMode.format != _oldVideoMode.format) { + errors |= OSystem::kTransactionFormatNotSupported; + + _videoMode.format = _oldVideoMode.format; + _screenFormat = _videoMode.format; +#endif + } else if (_videoMode.screenWidth != _oldVideoMode.screenWidth || _videoMode.screenHeight != _oldVideoMode.screenHeight) { + errors |= OSystem::kTransactionSizeChangeFailed; + + _videoMode.screenWidth = _oldVideoMode.screenWidth; + _videoMode.screenHeight = _oldVideoMode.screenHeight; + _videoMode.overlayWidth = _oldVideoMode.overlayWidth; + _videoMode.overlayHeight = _oldVideoMode.overlayHeight; + } + + if (_videoMode.fullscreen == _oldVideoMode.fullscreen && + //_videoMode.aspectRatioCorrection == _oldVideoMode.aspectRatioCorrection && + _videoMode.mode == _oldVideoMode.mode && + _videoMode.screenWidth == _oldVideoMode.screenWidth && + _videoMode.screenHeight == _oldVideoMode.screenHeight) { + + // Our new video mode would now be exactly the same as the + // old one. Since we still can not assume SDL_SetVideoMode + // to be working fine, we need to invalidate the old video + // mode, so loadGFXMode would error out properly. + _oldVideoMode.setup = false; + } + } + +#ifdef USE_RGB_COLOR + if (_transactionDetails.sizeChanged || _transactionDetails.formatChanged) { +#else + if (_transactionDetails.sizeChanged) { +#endif + unloadGFXMode(); + if (!loadGFXMode()) { + if (_oldVideoMode.setup) { + _transactionMode = kTransactionRollback; + errors |= endGFXTransaction(); + } + } else { + //setGraphicsModeIntern(); + //clearOverlay(); + + _videoMode.setup = true; + _screenChangeCount++; + } + } else if (_transactionDetails.needHotswap) { + //setGraphicsModeIntern(); + if (!hotswapGFXMode()) { + if (_oldVideoMode.setup) { + _transactionMode = kTransactionRollback; + errors |= endGFXTransaction(); + } + } else { + _videoMode.setup = true; + _screenChangeCount++; + + if (_transactionDetails.needUpdatescreen) + internUpdateScreen(); + } + } else if (_transactionDetails.needUpdatescreen) { + //setGraphicsModeIntern(); + internUpdateScreen(); + } + + _transactionMode = kTransactionNone; + return (OSystem::TransactionError)errors; } // @@ -117,11 +251,11 @@ OSystem::TransactionError OpenGLGraphicsManager::endGFXTransaction() { // int16 OpenGLGraphicsManager::getHeight() { - return 0; + return _videoMode.screenHeight; } int16 OpenGLGraphicsManager::getWidth() { - return 0; + return _videoMode.screenWidth; } void OpenGLGraphicsManager::setPalette(const byte *colors, uint start, uint num) { @@ -194,11 +328,11 @@ void OpenGLGraphicsManager::copyRectToOverlay(const OverlayColor *buf, int pitch } int16 OpenGLGraphicsManager::getOverlayHeight() { - return 0; + return _videoMode.overlayHeight; } int16 OpenGLGraphicsManager::getOverlayWidth() { - return 0; + return _videoMode.overlayWidth; } // diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index 664b1c138d..ef71028854 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -96,13 +96,54 @@ protected: GLTexture* _overlayTexture; GLTexture* _mouseTexture; - - Graphics::Surface _lockedScreen; - virtual void internUpdateScreen(); virtual bool loadGFXMode(); virtual void unloadGFXMode(); virtual bool hotswapGFXMode(); + + Graphics::Surface _lockedScreen; + int _screenChangeCount; + +#ifdef USE_RGB_COLOR + Graphics::PixelFormat _screenFormat; + Graphics::PixelFormat _cursorFormat; +#endif + + enum { + kTransactionNone = 0, + kTransactionActive = 1, + kTransactionRollback = 2 + }; + + struct TransactionDetails { + bool sizeChanged; + bool needHotswap; + bool needUpdatescreen; +#ifdef USE_RGB_COLOR + bool formatChanged; +#endif + }; + TransactionDetails _transactionDetails; + int _transactionMode; + + struct VideoState { + bool setup; + + bool fullscreen; + //bool aspectRatioCorrection; + //AspectRatio desiredAspectRatio; + + int mode; + int scaleFactor; + + int screenWidth, screenHeight; + int overlayWidth, overlayHeight; + int hardwareWidth, hardwareHeight; +#ifdef USE_RGB_COLOR + Graphics::PixelFormat format; +#endif + }; + VideoState _videoMode, _oldVideoMode; }; #endif diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index ad6952bf21..589e5aa2c6 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -25,17 +25,17 @@ #include "backends/graphics/openglsdl/openglsdl-graphics.h" -OpenGLSDLGraphicsManager::OpenGLSDLGraphicsManager() +OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager() : _hwscreen(0) { } -OpenGLSDLGraphicsManager::~OpenGLSDLGraphicsManager() { +OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() { } -void OpenGLSDLGraphicsManager::init() { +void OpenGLSdlGraphicsManager::init() { if (SDL_InitSubSystem(SDL_INIT_VIDEO) == -1) { error("Could not initialize SDL: %s", SDL_GetError()); } @@ -45,50 +45,74 @@ void OpenGLSDLGraphicsManager::init() { OpenGLGraphicsManager::init(); } -void OpenGLSDLGraphicsManager::forceFullRedraw() { +void OpenGLSdlGraphicsManager::forceFullRedraw() { } -bool OpenGLSDLGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) { +bool OpenGLSdlGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) { return false; } -bool OpenGLSDLGraphicsManager::isScalerHotkey(const Common::Event &event) { +bool OpenGLSdlGraphicsManager::isScalerHotkey(const Common::Event &event) { return false; } -void OpenGLSDLGraphicsManager::adjustMouseEvent(Common::Event &event) { +void OpenGLSdlGraphicsManager::adjustMouseEvent(Common::Event &event) { } -void OpenGLSDLGraphicsManager::setMousePos(int x, int y) { +void OpenGLSdlGraphicsManager::setMousePos(int x, int y) { } -void OpenGLSDLGraphicsManager::toggleFullScreen() { +void OpenGLSdlGraphicsManager::toggleFullScreen() { } -bool OpenGLSDLGraphicsManager::saveScreenshot(const char *filename) { +bool OpenGLSdlGraphicsManager::saveScreenshot(const char *filename) { return false; } // -// Protected +// Intern // -bool OpenGLSDLGraphicsManager::loadGFXMode() { - return false; -} +bool OpenGLSdlGraphicsManager::loadGFXMode() { + _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; + _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; + _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor; + _videoMode.hardwareHeight = _videoMode.screenHeight * _videoMode.scaleFactor; + + + _hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 32, + _videoMode.fullscreen ? (SDL_FULLSCREEN | SDL_OPENGL) : SDL_OPENGL + ); + if (_hwscreen == NULL) { + // DON'T use error(), as this tries to bring up the debug + // console, which WON'T WORK now that _hwscreen is hosed. + + if (!_oldVideoMode.setup) { + warning("SDL_SetVideoMode says we can't switch to that mode (%s)", SDL_GetError()); + g_system->quit(); + } else { + return false; + } + } -void OpenGLSDLGraphicsManager::unloadGFXMode() { + return true; +} +void OpenGLSdlGraphicsManager::unloadGFXMode() { + if (_hwscreen) { + SDL_FreeSurface(_hwscreen); + _hwscreen = NULL; + } } -bool OpenGLSDLGraphicsManager::hotswapGFXMode() { +bool OpenGLSdlGraphicsManager::hotswapGFXMode() { return false; } -void OpenGLSDLGraphicsManager::internUpdateScreen() { +void OpenGLSdlGraphicsManager::internUpdateScreen() { } diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index e565af24be..9f18489430 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -37,10 +37,10 @@ /** * SDL OpenGL graphics manager */ -class OpenGLSDLGraphicsManager : public OpenGLGraphicsManager { +class OpenGLSdlGraphicsManager : public OpenGLGraphicsManager { public: - OpenGLSDLGraphicsManager(); - virtual ~OpenGLSDLGraphicsManager(); + OpenGLSdlGraphicsManager(); + virtual ~OpenGLSdlGraphicsManager(); virtual void init(); diff --git a/backends/graphics/sdl/basesdl-graphics.h b/backends/graphics/sdl/basesdl-graphics.h deleted file mode 100644 index 6e25e095f4..0000000000 --- a/backends/graphics/sdl/basesdl-graphics.h +++ /dev/null @@ -1,79 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -#ifndef BACKENDS_GRAPHICS_BASESDL_H -#define BACKENDS_GRAPHICS_BASESDL_H - -#include "backends/graphics/graphics.h" - -#if defined(__SYMBIAN32__) -#include <esdl\SDL.h> -#else -#include <SDL.h> -#endif - -/** - * Base SDL graphics manager, contains common functions - * used by other SDL managers - */ -class BaseSdlGraphicsManager : public GraphicsManager { -public: - /** - * Marks the screen for a full redraw - */ - virtual void forceFullRedraw() = 0; - - /** - * Handles the scalar hotkeys - */ - virtual bool handleScalerHotkeys(const SDL_KeyboardEvent &key) = 0; - - /** - * Returns if the event passed is a hotkey for the graphics scalers - */ - virtual bool isScalerHotkey(const Common::Event &event) = 0; - - /** - * Adjusts mouse event coords for the current scaler - */ - virtual void adjustMouseEvent(Common::Event &event) = 0; - - /** - * Updates the mouse cursor position - */ - virtual void setMousePos(int x, int y) = 0; - - /** - * Toggles fullscreen - */ - virtual void toggleFullScreen() = 0; - - /** - * Saves a screenshot to a file - */ - virtual bool saveScreenshot(const char *filename) = 0; -}; - -#endif diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp index 51283f4494..26a5a6302c 100644 --- a/backends/graphics/sdl/sdl-graphics.cpp +++ b/backends/graphics/sdl/sdl-graphics.cpp @@ -1967,9 +1967,10 @@ void SdlGraphicsManager::displayMessageOnOSD(const char *msg) { } #endif -bool SdlGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) { +bool SdlGraphicsManager::handleScalerHotkeys(Common::KeyCode key) { + // Ctrl-Alt-a toggles aspect ratio correction - if (key.keysym.sym == 'a') { + if (key == 'a') { beginGFXTransaction(); setFeatureState(OSystem::kFeatureAspectRatioCorrection, !_videoMode.aspectRatioCorrection); endGFXTransaction(); @@ -1995,18 +1996,18 @@ bool SdlGraphicsManager::handleScalerHotkeys(const SDL_KeyboardEvent &key) { int factor = _videoMode.scaleFactor - 1; // Increase/decrease the scale factor - if (key.keysym.sym == SDLK_EQUALS || key.keysym.sym == SDLK_PLUS || key.keysym.sym == SDLK_MINUS || - key.keysym.sym == SDLK_KP_PLUS || key.keysym.sym == SDLK_KP_MINUS) { - factor += (key.keysym.sym == SDLK_MINUS || key.keysym.sym == SDLK_KP_MINUS) ? -1 : +1; + if (key == SDLK_EQUALS || key == SDLK_PLUS || key == SDLK_MINUS || + key == SDLK_KP_PLUS || key == SDLK_KP_MINUS) { + factor += (key == SDLK_MINUS || key == SDLK_KP_MINUS) ? -1 : +1; if (0 <= factor && factor <= 3) { newMode = s_gfxModeSwitchTable[_scalerType][factor]; } } - const bool isNormalNumber = (SDLK_1 <= key.keysym.sym && key.keysym.sym <= SDLK_9); - const bool isKeypadNumber = (SDLK_KP1 <= key.keysym.sym && key.keysym.sym <= SDLK_KP9); + const bool isNormalNumber = (SDLK_1 <= key && key <= SDLK_9); + const bool isKeypadNumber = (SDLK_KP1 <= key && key <= SDLK_KP9); if (isNormalNumber || isKeypadNumber) { - _scalerType = key.keysym.sym - (isNormalNumber ? SDLK_1 : SDLK_KP1); + _scalerType = key - (isNormalNumber ? SDLK_1 : SDLK_KP1); if (_scalerType >= ARRAYSIZE(s_gfxModeSwitchTable)) return false; diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h index b5bb23d247..4ca92e9d30 100644 --- a/backends/graphics/sdl/sdl-graphics.h +++ b/backends/graphics/sdl/sdl-graphics.h @@ -26,10 +26,16 @@ #ifndef BACKENDS_GRAPHICS_SDL_H #define BACKENDS_GRAPHICS_SDL_H -#include "backends/graphics/sdl/basesdl-graphics.h" +#include "backends/graphics/graphics.h" #include "common/system.h" #include "graphics/scaler.h" +#if defined(__SYMBIAN32__) +#include <esdl\SDL.h> +#else +#include <SDL.h> +#endif + #if !defined(_WIN32_WCE) && !defined(__SYMBIAN32__) // Uncomment this to enable the 'on screen display' code. #define USE_OSD 1 @@ -66,7 +72,7 @@ public: /** * SDL graphics manager */ -class SdlGraphicsManager : public BaseSdlGraphicsManager { +class SdlGraphicsManager : public GraphicsManager { public: SdlGraphicsManager(); virtual ~SdlGraphicsManager(); @@ -122,7 +128,7 @@ public: #endif virtual void forceFullRedraw(); - virtual bool handleScalerHotkeys(const SDL_KeyboardEvent &key); + virtual bool handleScalerHotkeys(Common::KeyCode key); virtual bool isScalerHotkey(const Common::Event &event); virtual void adjustMouseEvent(Common::Event &event); virtual void setMousePos(int x, int y); diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp index 49e34bd9b0..3a18014b3a 100644 --- a/backends/modular-backend.cpp +++ b/backends/modular-backend.cpp @@ -70,6 +70,11 @@ bool ModularBackend::getFeatureState(Feature f) { return _graphicsManager->getFeatureState(f); } +GraphicsManager *ModularBackend::getGraphicsManager() { + assert(_graphicsManager); + return (GraphicsManager *)_graphicsManager; +} + const OSystem::GraphicsMode *ModularBackend::getSupportedGraphicsModes() const { return _graphicsManager->getSupportedGraphicsModes(); } diff --git a/backends/modular-backend.h b/backends/modular-backend.h index 2b95d31dc5..a60fccc876 100644 --- a/backends/modular-backend.h +++ b/backends/modular-backend.h @@ -69,6 +69,7 @@ public: /** @name Graphics */ //@{ + virtual GraphicsManager *getGraphicsManager(); virtual const GraphicsMode *getSupportedGraphicsModes() const; virtual int getDefaultGraphicsMode() const; virtual bool setGraphicsMode(int mode); diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 52a2b335aa..e5ae3bb523 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -86,9 +86,9 @@ void OSystem_SDL::initBackend() { if (_graphicsManager == 0) { // Changed to OpenGL for testing //_graphicsManager = new SdlGraphicsManager(); - _graphicsManager = new OpenGLSDLGraphicsManager(); + _graphicsManager = new OpenGLSdlGraphicsManager(); - ((OpenGLSDLGraphicsManager *)_graphicsManager)->init(); + ((OpenGLSdlGraphicsManager *)_graphicsManager)->init(); } if (_audiocdManager == 0) @@ -241,11 +241,6 @@ void OSystem_SDL::setupIcon() { free(icon); } -BaseSdlGraphicsManager *OSystem_SDL::getGraphicsManager() { - assert(_graphicsManager); - return (BaseSdlGraphicsManager *)_graphicsManager; -} - bool OSystem_SDL::pollEvent(Common::Event &event) { assert(_eventManager); return ((SdlEventManager *)_eventManager)->pollSdlEvent(event); diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index 97c91966c1..3bb09683b5 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -33,7 +33,6 @@ #endif #include "backends/modular-backend.h" -#include "backends/graphics/sdl/basesdl-graphics.h" #include "backends/mixer/sdl/sdl-mixer.h" /** @@ -52,11 +51,6 @@ public: virtual void init(); /** - * Get the Graphics Manager instance. Used by other managers. - */ - virtual BaseSdlGraphicsManager *getGraphicsManager(); - - /** * Get the Mixer Manager instance. Not to confuse with getMixer(), * that returns Audio::Mixer. The Mixer Manager is a SDL wrapper class * for the Audio::Mixer. Used by other managers. |