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 /backends/graphics/openglsdl | |
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
Diffstat (limited to 'backends/graphics/openglsdl')
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 58 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.h | 6 |
2 files changed, 44 insertions, 20 deletions
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(); |