diff options
author | Johannes Schickel | 2010-10-21 18:13:13 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-10-21 18:13:13 +0000 |
commit | b713beed189b439853be50fa330d06b3275f9713 (patch) | |
tree | 470b703d99f003606ea11b4db9d670b063038ab0 /backends/platform/sdl/sdl.cpp | |
parent | f08b144c5a3c071cefb8f7b9f3b99d151337384d (diff) | |
download | scummvm-rg350-b713beed189b439853be50fa330d06b3275f9713.tar.gz scummvm-rg350-b713beed189b439853be50fa330d06b3275f9713.tar.bz2 scummvm-rg350-b713beed189b439853be50fa330d06b3275f9713.zip |
OPENGL: Add an SdlEventSource member to OSystem_SDL instead of subclassing SdlEventSource.
Derived backends are allowed to overwrite that member in case they need special
handling of SDL events.
svn-id: r53675
Diffstat (limited to 'backends/platform/sdl/sdl.cpp')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 5428a791e0..fbfb83fa1d 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -51,7 +51,8 @@ OSystem_SDL::OSystem_SDL() #endif _inited(false), _initedSDL(false), - _mixerManager(0) { + _mixerManager(0), + _eventSource(0) { } @@ -81,6 +82,11 @@ void OSystem_SDL::initBackend() { // Check if backend has not been initialized assert(!_inited); + // Create the default event source, in case a custom backend + // manager didn't provide one yet. + if (_eventSource == 0) + _eventSource = new SdlEventSource(); + int graphicsManagerType = 0; if (_graphicsManager == 0) { @@ -104,7 +110,7 @@ void OSystem_SDL::initBackend() { } #endif if (_graphicsManager == 0) { - _graphicsManager = new SdlGraphicsManager(this); + _graphicsManager = new SdlGraphicsManager(_eventSource); graphicsManagerType = 0; } } @@ -112,7 +118,7 @@ void OSystem_SDL::initBackend() { // Creates the backend managers, if they don't exist yet (we check // for this to allow subclasses to provide their own). if (_eventManager == 0) - _eventManager = new DefaultEventManager(this); + _eventManager = new DefaultEventManager(_eventSource); // We have to initialize the graphics manager before the event manager // so the virtual keyboard can be initialized, but we have to add the @@ -216,6 +222,8 @@ void OSystem_SDL::deinit() { _graphicsManager = 0; delete _eventManager; _eventManager = 0; + delete _eventSource; + _eventSource = 0; delete _audiocdManager; _audiocdManager = 0; delete _mixerManager; @@ -352,7 +360,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(this); + _graphicsManager = new SdlGraphicsManager(_eventSource); ((SdlGraphicsManager *)_graphicsManager)->initEventObserver(); _graphicsManager->beginGFXTransaction(); } else if (_graphicsMode < _sdlModesCount && mode >= _sdlModesCount) { |