[Scummvm-cvs-logs] SF.net SVN: scummvm:[53675] scummvm/branches/gsoc2010-opengl/backends/ platform/sdl
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Thu Oct 21 20:13:13 CEST 2010
Revision: 53675
http://scummvm.svn.sourceforge.net/scummvm/?rev=53675&view=rev
Author: lordhoto
Date: 2010-10-21 18:13:13 +0000 (Thu, 21 Oct 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp 2010-10-21 17:09:57 UTC (rev 53674)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp 2010-10-21 18:13:13 UTC (rev 53675)
@@ -51,7 +51,8 @@
#endif
_inited(false),
_initedSDL(false),
- _mixerManager(0) {
+ _mixerManager(0),
+ _eventSource(0) {
}
@@ -81,6 +82,11 @@
// 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 @@
}
#endif
if (_graphicsManager == 0) {
- _graphicsManager = new SdlGraphicsManager(this);
+ _graphicsManager = new SdlGraphicsManager(_eventSource);
graphicsManagerType = 0;
}
}
@@ -112,7 +118,7 @@
// 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 @@
_graphicsManager = 0;
delete _eventManager;
_eventManager = 0;
+ delete _eventSource;
+ _eventSource = 0;
delete _audiocdManager;
_audiocdManager = 0;
delete _mixerManager;
@@ -352,7 +360,7 @@
// 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) {
Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h 2010-10-21 17:09:57 UTC (rev 53674)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h 2010-10-21 18:13:13 UTC (rev 53675)
@@ -39,7 +39,7 @@
/**
* Base OSystem class for all SDL ports.
*/
-class OSystem_SDL : public ModularBackend, public SdlEventSource {
+class OSystem_SDL : public ModularBackend {
public:
OSystem_SDL();
virtual ~OSystem_SDL();
@@ -89,6 +89,11 @@
SdlMixerManager *_mixerManager;
/**
+ * The event source we use for obtaining SDL events.
+ */
+ SdlEventSource *_eventSource;
+
+ /**
* Initialze the SDL library.
*/
virtual void initSDL();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list