From 34302765caecabf21cc884de95805b3e1d8f8ea1 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 13 Oct 2010 15:42:53 +0000 Subject: OPENGL: Get rid of one ugly cast. svn-id: r53435 --- backends/graphics/sdl/sdl-graphics.cpp | 5 +++-- backends/graphics/sdl/sdl-graphics.h | 6 +++++- backends/platform/sdl/sdl.cpp | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp index 2c0320f5d0..36d4c52239 100644 --- a/backends/graphics/sdl/sdl-graphics.cpp +++ b/backends/graphics/sdl/sdl-graphics.cpp @@ -120,8 +120,9 @@ static AspectRatio getDesiredAspectRatio() { } #endif -SdlGraphicsManager::SdlGraphicsManager() +SdlGraphicsManager::SdlGraphicsManager(SdlEventSource *sdlEventSource) : + _sdlEventSource(sdlEventSource), #ifdef USE_OSD _osdSurface(0), _osdAlpha(SDL_ALPHA_TRANSPARENT), _osdFadeStartTime(0), #endif @@ -821,7 +822,7 @@ bool SdlGraphicsManager::loadGFXMode() { SDL_SetColorKey(_osdSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, kOSDColorKey); #endif - ((SdlEventSource *)g_system)->resetKeyboadEmulation( + _sdlEventSource->resetKeyboadEmulation( _videoMode.screenWidth * _videoMode.scaleFactor - 1, effectiveScreenHeight() - 1); diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h index 7c6f95f134..62f87ee238 100644 --- a/backends/graphics/sdl/sdl-graphics.h +++ b/backends/graphics/sdl/sdl-graphics.h @@ -31,6 +31,8 @@ #include "common/events.h" #include "common/system.h" +#include "backends/events/sdl/sdl-events.h" + #if defined(__SYMBIAN32__) #include #else @@ -75,7 +77,7 @@ public: */ class SdlGraphicsManager : public GraphicsManager, public Common::EventObserver { public: - SdlGraphicsManager(); + SdlGraphicsManager(SdlEventSource *sdlEventSource); virtual ~SdlGraphicsManager(); virtual void initEventObserver(); @@ -136,6 +138,8 @@ public: bool notifyEvent(const Common::Event &event); protected: + SdlEventSource *_sdlEventSource; + #ifdef USE_OSD /** Surface containing the OSD message */ SDL_Surface *_osdSurface; diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 38bf4d0ba9..f3609d8212 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -104,7 +104,7 @@ void OSystem_SDL::initBackend() { } #endif if (_graphicsManager == 0) { - _graphicsManager = new SdlGraphicsManager(); + _graphicsManager = new SdlGraphicsManager(this); graphicsManagerType = 0; } } @@ -352,7 +352,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) { // manager, delete and create the new mode graphics manager if (_graphicsMode >= _sdlModesCount && mode < _sdlModesCount) { delete _graphicsManager; - _graphicsManager = new SdlGraphicsManager(); + _graphicsManager = new SdlGraphicsManager(this); ((SdlGraphicsManager *)_graphicsManager)->initEventObserver(); _graphicsManager->beginGFXTransaction(); } else if (_graphicsMode < _sdlModesCount && mode >= _sdlModesCount) { -- cgit v1.2.3