[Scummvm-cvs-logs] SF.net SVN: scummvm:[49590] scummvm/branches/gsoc2010-opengl/backends

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Fri Jun 11 04:50:26 CEST 2010


Revision: 49590
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49590&view=rev
Author:   vgvgf
Date:     2010-06-11 02:50:25 +0000 (Fri, 11 Jun 2010)

Log Message:
-----------
Add Common::EventSource inheritance for ModularBackend. OSystem_SDL now subclass from ModularBackend insteand of BaseBackend. Added forceFullRedraw() to SdlGraphicsManager and removed _modeChanged.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h
    scummvm/branches/gsoc2010-opengl/backends/modular-backend.h
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/events.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
    scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp	2010-06-11 01:55:59 UTC (rev 49589)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp	2010-06-11 02:50:25 UTC (rev 49590)
@@ -128,7 +128,7 @@
 #endif
 	_overlayVisible(false),
 	_overlayscreen(0), _tmpscreen2(0),
-	_scalerProc(0), _modeChanged(false), _screenChangeCount(0),
+	_scalerProc(0), _screenChangeCount(0),
 	_mouseVisible(false), _mouseNeedsRedraw(false), _mouseData(0), _mouseSurface(0),
 	_mouseOrigSurface(0), _cursorTargetScale(1), _cursorPaletteDisabled(true),
 	_currentShakePos(0), _newShakePos(0),
@@ -322,7 +322,6 @@
 			clearOverlay();
 
 			_videoMode.setup = true;
-			_modeChanged = true;
 			// OSystem_SDL::pollEvent used to update the screen change count,
 			// but actually it gives problems when a video mode was changed
 			// but OSystem_SDL::pollEvent was not called. This for example
@@ -339,7 +338,6 @@
 			}
 		} else {
 			_videoMode.setup = true;
-			_modeChanged = true;
 			// OSystem_SDL::pollEvent used to update the screen change count,
 			// but actually it gives problems when a video mode was changed
 			// but OSystem_SDL::pollEvent was not called. This for example
@@ -2072,4 +2070,8 @@
 	return false;
 }
 
+void SdlGraphicsManager::forceFullRedraw() {
+	_forceFull = true;
+}
+
 #endif

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h	2010-06-11 01:55:59 UTC (rev 49589)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h	2010-06-11 02:50:25 UTC (rev 49590)
@@ -126,14 +126,8 @@
 	void displayMessageOnOSD(const char *msg);
 #endif
 
-	// Accessed from OSystem_SDL::pollEvent for EVENT_SCREEN_CHANGED
-	// The way this event works should be changed
-	bool _modeChanged;
+	void forceFullRedraw();
 
-	// Accessed from OSystem_SDL::dispatchSDLEvent
-	// A function here for toggling it should be made for this
-	bool _forceFull;
-
 	bool handleScalerHotkeys(const SDL_KeyboardEvent &key); // Move this?
 	bool isScalerHotkey(const Common::Event &event); // Move this?
 
@@ -210,6 +204,8 @@
 	virtual void setGraphicsModeIntern(); // overloaded by CE backend
 
 	/** Force full redraw on next updateScreen */
+	bool _forceFull;
+
 	ScalerProc *_scalerProc;
 	int _scalerType;
 	int _transactionMode;

Modified: scummvm/branches/gsoc2010-opengl/backends/modular-backend.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/modular-backend.h	2010-06-11 01:55:59 UTC (rev 49589)
+++ scummvm/branches/gsoc2010-opengl/backends/modular-backend.h	2010-06-11 02:50:25 UTC (rev 49590)
@@ -32,7 +32,7 @@
 #include "backends/mutex/null/null-mutex.h"
 #include "backends/graphics/null/null-graphics.h"
 
-class ModularBackend : public OSystem {
+class ModularBackend : public OSystem, public Common::EventSource {
 public:
 	ModularBackend();
 	virtual ~ModularBackend();

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/events.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/events.cpp	2010-06-11 01:55:59 UTC (rev 49589)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/events.cpp	2010-06-11 02:50:25 UTC (rev 49590)
@@ -184,11 +184,11 @@
 	handleKbdMouse();
 
 	// If the screen mode changed, send an Common::EVENT_SCREEN_CHANGED
-	if (_graphicsManager->_modeChanged) {
+	/*if (_graphicsManager->_modeChanged) { // TODO: use getScreenChangeID
 		_graphicsManager->_modeChanged = false;
 		event.type = Common::EVENT_SCREEN_CHANGED;
 		return true;
-	}
+	}*/
 
 	while (SDL_PollEvent(&ev)) {
 		preprocessEvents(&ev);
@@ -218,7 +218,7 @@
 		return handleJoyAxisMotion(ev, event);
 
 	case SDL_VIDEOEXPOSE:
-		_graphicsManager->_forceFull = true;
+		((SdlGraphicsManager *)_graphicsManager)->forceFullRedraw();
 		break;
 
 	case SDL_QUIT:
@@ -312,7 +312,7 @@
 
 	// 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 (_graphicsManager->handleScalerHotkeys(ev.key))
+		if (((SdlGraphicsManager *)_graphicsManager)->handleScalerHotkeys(ev.key))
 			return false;
 	}
 
@@ -341,7 +341,7 @@
 	if (_scrollLock)
 		event.kbd.flags |= Common::KBD_SCRL;
 
-	if (_graphicsManager->isScalerHotkey(event))
+	if (((SdlGraphicsManager *)_graphicsManager)->isScalerHotkey(event))
 		// Swallow these key up events
 		return false;
 
@@ -352,7 +352,7 @@
 	event.type = Common::EVENT_MOUSEMOVE;
 	fillMouseEvent(event, ev.motion.x, ev.motion.y);
 
-	_graphicsManager->setMousePos(event.mouse.x, event.mouse.y);
+	((SdlGraphicsManager *)_graphicsManager)->setMousePos(event.mouse.x, event.mouse.y);
 	return true;
 }
 

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp	2010-06-11 01:55:59 UTC (rev 49589)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.cpp	2010-06-11 02:50:25 UTC (rev 49590)
@@ -118,13 +118,19 @@
 		_joystick = SDL_JoystickOpen(joystick_num);
 	}
 
+	// Create and hook up the event manager, if none exists yet (we check for
+	// this to allow subclasses to provide their own).
+	if (_eventManager == 0) {
+		_eventManager = new DefaultEventManager(this);
+	}
+
 	// Create the savefile manager, if none exists yet (we check for this to
 	// allow subclasses to provide their own).
-	if (_savefile == 0) {
+	if (_savefileManager == 0) {
 #ifdef UNIX
-	_savefile = new POSIXSaveFileManager();
+	_savefileManager = new POSIXSaveFileManager();
 #else
-	_savefile = new DefaultSaveFileManager();
+	_savefileManager = new DefaultSaveFileManager();
 #endif
 	}
 
@@ -141,14 +147,14 @@
 
 	// Create and hook up the timer manager, if none exists yet (we check for
 	// this to allow subclasses to provide their own).
-	if (_timer == 0) {
+	if (_timerManager == 0) {
 		// TODO: Implement SdlTimerManager
 		if (SDL_InitSubSystem(SDL_INIT_TIMER) == -1) {
 			error("Could not initialize SDL: %s", SDL_GetError());
 		}
 
-		_timer = new DefaultTimerManager();
-		_timerID = SDL_AddTimer(10, &timer_handler, _timer);
+		_timerManager = new DefaultTimerManager();
+		_timerID = SDL_AddTimer(10, &timer_handler, _timerManager);
 	}
 
 	// Create and hook up the graphics manager, if none exists yet (we check for
@@ -158,7 +164,7 @@
 	}
 
 	if (_audiocdManager == 0) {
-		_audiocdManager = new SdlAudioCDManager();
+		_audiocdManager = (AudioCDManager *)new SdlAudioCDManager();
 	}
 
 #if !defined(MACOSX) && !defined(__SYMBIAN32__)
@@ -176,19 +182,12 @@
 
 OSystem_SDL::OSystem_SDL()
 	:
-	_scrollLock(false),
-	_joystick(0),
 #if MIXER_DOUBLE_BUFFERING
 	_soundMutex(0), _soundCond(0), _soundThread(0),
 	_soundThreadIsRunning(false), _soundThreadShouldQuit(false),
 #endif
-	_fsFactory(0),
-	_savefile(0),
-	_mixer(0),
-	_timer(0),
-	_mutexManager(0),
-	_graphicsManager(0),
-	_audiocdManager(0) {
+	_scrollLock(false),
+	_joystick(0) {
 
 	// reset mouse state
 	memset(&_km, 0, sizeof(_km));
@@ -212,8 +211,8 @@
 	SDL_RemoveTimer(_timerID);
 	closeMixer();
 
-	delete _savefile;
-	delete _timer;
+	delete _savefileManager;
+	delete _timerManager;
 }
 
 uint32 OSystem_SDL::getMillis() {
@@ -237,21 +236,6 @@
 	td.tm_year = t.tm_year;
 }
 
-Common::TimerManager *OSystem_SDL::getTimerManager() {
-	assert(_timer);
-	return _timer;
-}
-
-Common::SaveFileManager *OSystem_SDL::getSavefileManager() {
-	assert(_savefile);
-	return _savefile;
-}
-
-FilesystemFactory *OSystem_SDL::getFilesystemFactory() {
-	assert(_fsFactory);
-	return _fsFactory;
-}
-
 void OSystem_SDL::addSysArchivesToSearchSet(Common::SearchSet &s, int priority) {
 
 #ifdef DATA_PATH
@@ -375,18 +359,6 @@
 	SDL_WM_SetCaption(cap.c_str(), cap.c_str());
 }
 
-bool OSystem_SDL::hasFeature(Feature f) {
-	return _graphicsManager->hasFeature(f);
-}
-
-void OSystem_SDL::setFeatureState(Feature f, bool enable) {
-	_graphicsManager->setFeatureState(f, enable);
-}
-
-bool OSystem_SDL::getFeatureState(Feature f) {
-	return _graphicsManager->getFeatureState(f);
-}
-
 void OSystem_SDL::deinit() {
 	if (_joystick)
 		SDL_JoystickClose(_joystick);
@@ -396,14 +368,14 @@
 	SDL_RemoveTimer(_timerID);
 	closeMixer();
 
-	delete _timer;
+	delete _timerManager;
 
 	SDL_Quit();
 
 	// Event Manager requires save manager for storing
 	// recorded events
 	delete getEventManager();
-	delete _savefile;
+	delete _savefileManager;
 }
 
 void OSystem_SDL::quit() {
@@ -467,26 +439,6 @@
 }
 
 #pragma mark -
-#pragma mark --- Mutex ---
-#pragma mark -
-
-OSystem::MutexRef OSystem_SDL::createMutex() {
-	return _mutexManager->createMutex();
-}
-
-void OSystem_SDL::lockMutex(MutexRef mutex) {
-	_mutexManager->lockMutex(mutex);
-}
-
-void OSystem_SDL::unlockMutex(MutexRef mutex) {
-	_mutexManager->unlockMutex(mutex);
-}
-
-void OSystem_SDL::deleteMutex(MutexRef mutex) {
-	_mutexManager->deleteMutex(mutex);
-}
-
-#pragma mark -
 #pragma mark --- Audio ---
 #pragma mark -
 
@@ -585,11 +537,11 @@
 #else
 
 void OSystem_SDL::mixCallback(void *sys, byte *samples, int len) {
-	OSystem_SDL *this_ = (OSystem_SDL *)sys;
+	ModularBackend *this_ = (ModularBackend *)sys;
 	assert(this_);
-	assert(this_->_mixer);
+	assert(this_->getMixer());
 
-	this_->_mixer->mixCallback(samples, len);
+	((Audio::MixerImpl *)this_->getMixer())->mixCallback(samples, len);
 }
 
 #endif
@@ -625,7 +577,7 @@
 		warning("Could not open audio device: %s", SDL_GetError());
 		_mixer = new Audio::MixerImpl(this, samplesPerSec);
 		assert(_mixer);
-		_mixer->setReady(false);
+		((Audio::MixerImpl *)_mixer)->setReady(false);
 	} else {
 		// Note: This should be the obtained output rate, but it seems that at
 		// least on some platforms SDL will lie and claim it did get the rate
@@ -636,7 +588,7 @@
 		// Create the mixer instance and start the sound processing
 		_mixer = new Audio::MixerImpl(this, samplesPerSec);
 		assert(_mixer);
-		_mixer->setReady(true);
+		((Audio::MixerImpl *)_mixer)->setReady(true);
 
 #if MIXER_DOUBLE_BUFFERING
 		initThreadedMixer(_mixer, _obtainedRate.samples * 4);
@@ -649,7 +601,7 @@
 
 void OSystem_SDL::closeMixer() {
 	if (_mixer)
-		_mixer->setReady(false);
+		((Audio::MixerImpl *)_mixer)->setReady(false);
 
 	SDL_CloseAudio();
 
@@ -661,161 +613,3 @@
 #endif
 
 }
-
-Audio::Mixer *OSystem_SDL::getMixer() {
-	assert(_mixer);
-	return _mixer;
-}
-
-#pragma mark -
-#pragma mark --- Graphics ---
-#pragma mark -
-
-const OSystem::GraphicsMode *OSystem_SDL::getSupportedGraphicsModes() const {
-	return _graphicsManager->getSupportedGraphicsModes();
-}
-
-int OSystem_SDL::getDefaultGraphicsMode() const {
-	return _graphicsManager->getDefaultGraphicsMode();
-}
-
-bool OSystem_SDL::setGraphicsMode(int mode) {
-	return _graphicsManager->setGraphicsMode(mode);
-}
-
-int OSystem_SDL::getGraphicsMode() const {
-	return _graphicsManager->getGraphicsMode();
-}
-
-#ifdef USE_RGB_COLOR
-Graphics::PixelFormat OSystem_SDL::getScreenFormat() const {
-	return _graphicsManager->getScreenFormat();
-}
-
-Common::List<Graphics::PixelFormat> OSystem_SDL::getSupportedFormats() {
-	return _graphicsManager->getSupportedFormats();
-}
-#endif
-
-void OSystem_SDL::beginGFXTransaction() {
-	_graphicsManager->beginGFXTransaction();
-}
-
-OSystem::TransactionError OSystem_SDL::endGFXTransaction() {
-	return _graphicsManager->endGFXTransaction();
-}
-
-void OSystem_SDL::initSize(uint w, uint h, const Graphics::PixelFormat *format ) {
-	_graphicsManager->initSize(w, h, format);
-}
-
-int16 OSystem_SDL::getHeight() {
-	return _graphicsManager->getHeight();
-}
-
-int16 OSystem_SDL::getWidth() {
-	return _graphicsManager->getWidth();
-}
-
-void OSystem_SDL::setPalette(const byte *colors, uint start, uint num) {
-	_graphicsManager->setPalette(colors, start, num);
-}
-
-void OSystem_SDL::grabPalette(byte *colors, uint start, uint num) {
-	_graphicsManager->grabPalette(colors, start, num);
-}
-
-void OSystem_SDL::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
-	_graphicsManager->copyRectToScreen(buf, pitch, x, y, w, h);
-}
-
-Graphics::Surface *OSystem_SDL::lockScreen() {
-	return _graphicsManager->lockScreen();
-}
-
-void OSystem_SDL::unlockScreen() {
-	_graphicsManager->unlockScreen();
-}
-
-/*void OSystem_SDL::fillScreen(uint32 col) {
-	_graphicsManager->fillScreen(col);
-}*/
-
-void OSystem_SDL::updateScreen() {
-	_graphicsManager->updateScreen();
-}
-
-void OSystem_SDL::setShakePos(int shakeOffset) {
-	_graphicsManager->setShakePos(shakeOffset);
-}
-
-void OSystem_SDL::showOverlay() {
-	_graphicsManager->showOverlay();
-}
-
-void OSystem_SDL::hideOverlay() {
-	_graphicsManager->hideOverlay();
-}
-
-Graphics::PixelFormat OSystem_SDL::getOverlayFormat() const {
-	return _graphicsManager->getOverlayFormat();
-}
-
-void OSystem_SDL::clearOverlay() {
-	_graphicsManager->clearOverlay();
-}
-
-void OSystem_SDL::grabOverlay(OverlayColor *buf, int pitch) {
-	_graphicsManager->grabOverlay(buf, pitch);
-}
-
-void OSystem_SDL::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
-	_graphicsManager->copyRectToOverlay(buf, pitch, x, y, w, h);
-}
-
-int16 OSystem_SDL::getOverlayHeight() {
-	return _graphicsManager->getOverlayHeight();
-}
-
-int16 OSystem_SDL::getOverlayWidth() {
-	return _graphicsManager->getOverlayWidth();
-}
-
-bool OSystem_SDL::showMouse(bool visible) {
-	return _graphicsManager->showMouse(visible);
-}
-
-void OSystem_SDL::warpMouse(int x, int y) {
-	_graphicsManager->warpMouse(x, y);
-}
-
-void OSystem_SDL::setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {
-	_graphicsManager->setMouseCursor(buf, w, h, hotspotX, hotspotY, keycolor, cursorTargetScale, format);
-}
-
-void OSystem_SDL::setCursorPalette(const byte *colors, uint start, uint num) {
-	_graphicsManager->setCursorPalette(colors, start, num);
-}
-
-void OSystem_SDL::disableCursorPalette(bool disable) {
-	_graphicsManager->disableCursorPalette(disable);
-}
-
-int OSystem_SDL::getScreenChangeID() const {
-	return _graphicsManager->getScreenChangeID();
-}
-
-#ifdef USE_OSD
-void OSystem_SDL::displayMessageOnOSD(const char *msg) {
-	_graphicsManager->displayMessageOnOSD(msg);
-}
-
-#pragma mark -
-#pragma mark --- AudioCD ---
-#pragma mark -
-
-AudioCDManager *OSystem_SDL::getAudioCD() {
-	return (AudioCDManager *)_audiocdManager;
-}
-
-#endif

Modified: scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h	2010-06-11 01:55:59 UTC (rev 49589)
+++ scummvm/branches/gsoc2010-opengl/backends/platform/sdl/sdl.h	2010-06-11 02:50:25 UTC (rev 49590)
@@ -32,7 +32,7 @@
 #include <SDL.h>
 #endif
 
-#include "backends/base-backend.h"
+#include "backends/modular-backend.h"
 
 #include "backends/mutex/sdl/sdl-mutex.h"
 #include "backends/graphics/sdl/sdl-graphics.h"
@@ -59,165 +59,46 @@
 #define MIXER_DOUBLE_BUFFERING 1
 #endif
 
-class OSystem_SDL : public BaseBackend {
+class OSystem_SDL : public ModularBackend {
 public:
 	OSystem_SDL();
 	virtual ~OSystem_SDL();
 
 	virtual void initBackend();
 
-
-protected:
-	SdlMutexManager *_mutexManager;
-	SdlGraphicsManager *_graphicsManager;
-	SdlAudioCDManager *_audiocdManager;
-
-public:
-	void beginGFXTransaction();
-	TransactionError endGFXTransaction();
-
-#ifdef USE_RGB_COLOR
-	// Game screen
-	virtual Graphics::PixelFormat getScreenFormat() const;
-
-	// Highest supported
-	virtual Common::List<Graphics::PixelFormat> getSupportedFormats();
-#endif
-
-	// Set the size and format of the video bitmap.
-	// Typically, 320x200 CLUT8
-	virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format); // overloaded by CE backend
-
-	virtual int getScreenChangeID() const;
-
-	// Set colors of the palette
-	void setPalette(const byte *colors, uint start, uint num);
-
-	// Get colors of the palette
-	void grabPalette(byte *colors, uint start, uint num);
-
-	// Draw a bitmap to screen.
-	// The screen will not be updated to reflect the new bitmap
-	virtual void copyRectToScreen(const byte *src, int pitch, int x, int y, int w, int h); // overloaded by CE backend (FIXME)
-
-	virtual Graphics::Surface *lockScreen();
-	virtual void unlockScreen();
-
-	// Update the dirty areas of the screen
-	void updateScreen();
-
-	// Either show or hide the mouse cursor
-	bool showMouse(bool visible);
-
-	// Warp the mouse cursor. Where set_mouse_pos() only informs the
-	// backend of the mouse cursor's current position, this function
-	// actually moves the cursor to the specified position.
-	virtual void warpMouse(int x, int y); // overloaded by CE backend (FIXME)
-
-	// Set the bitmap that's used when drawing the cursor.
-	virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format); // overloaded by CE backend (FIXME)
-
-	// Set colors of cursor palette
-	void setCursorPalette(const byte *colors, uint start, uint num);
-
-	// Disables or enables cursor palette
-	void disableCursorPalette(bool disable);
-
-	// Shaking is used in SCUMM. Set current shake position.
-	void setShakePos(int shake_pos);
-
 	// Get the number of milliseconds since the program was started.
 	uint32 getMillis();
 
 	// Delay for a specified amount of milliseconds
 	void delayMillis(uint msecs);
 
+	virtual void getTimeAndDate(TimeDate &t) const;
+
 	// Get the next event.
 	// Returns true if an event was retrieved.
 	virtual bool pollEvent(Common::Event &event); // overloaded by CE backend
 
-protected:
-	virtual bool dispatchSDLEvent(SDL_Event &ev, Common::Event &event);
-
-	// Handlers for specific SDL events, called by pollEvent.
-	// This way, if a backend inherits fromt the SDL backend, it can
-	// change the behavior of only a single event, without having to override all
-	// of pollEvent.
-	virtual bool handleKeyDown(SDL_Event &ev, Common::Event &event);
-	virtual bool handleKeyUp(SDL_Event &ev, Common::Event &event);
-	virtual bool handleMouseMotion(SDL_Event &ev, Common::Event &event);
-	virtual bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
-	virtual bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
-	virtual bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
-	virtual bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
-	virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event);
-
-public:
-
-
 	// Define all hardware keys for keymapper
 	virtual Common::HardwareKeySet *getHardwareKeySet();
 
+	virtual void preprocessEvents(SDL_Event *event) {}
+
 	// Set function that generates samples
 	virtual void setupMixer();
 	static void mixCallback(void *s, byte *samples, int len);
-
 	virtual void closeMixer();
 
-	virtual Audio::Mixer *getMixer();
-
 	// Quit
 	virtual void quit(); // overloaded by CE backend
 
 	void deinit();
 
-	virtual void getTimeAndDate(TimeDate &t) const;
-	virtual Common::TimerManager *getTimerManager();
-
-	// Mutex handling
-	MutexRef createMutex();
-	void lockMutex(MutexRef mutex);
-	void unlockMutex(MutexRef mutex);
-	void deleteMutex(MutexRef mutex);
-
-	// Overlay
-	virtual Graphics::PixelFormat getOverlayFormat() const;
-
-	virtual void showOverlay();
-	virtual void hideOverlay();
-	virtual void clearOverlay();
-	virtual void grabOverlay(OverlayColor *buf, int pitch);
-	virtual void copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h);
-	virtual int16 getHeight();
-	virtual int16 getWidth();
-	virtual int16 getOverlayHeight();
-	virtual int16 getOverlayWidth();
-
-	virtual const GraphicsMode *getSupportedGraphicsModes() const;
-	virtual int getDefaultGraphicsMode() const;
-	virtual bool setGraphicsMode(int mode);
-	virtual int getGraphicsMode() const;
-
 	virtual void setWindowCaption(const char *caption);
 
-	virtual bool hasFeature(Feature f);
-	virtual void setFeatureState(Feature f, bool enable);
-	virtual bool getFeatureState(Feature f);
-	virtual void preprocessEvents(SDL_Event *event) {}
-
-#ifdef USE_OSD
-	void displayMessageOnOSD(const char *msg);
-#endif
-
-	virtual Common::SaveFileManager *getSavefileManager();
-	virtual FilesystemFactory *getFilesystemFactory();
 	virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
-
 	virtual Common::SeekableReadStream *createConfigReadStream();
 	virtual Common::WriteStream *createConfigWriteStream();
 
-	virtual AudioCDManager *getAudioCD();
-
 protected:
 	bool _inited;
 	SDL_AudioSpec _obtainedRate;
@@ -238,6 +119,21 @@
 	// joystick
 	SDL_Joystick *_joystick;
 
+	virtual bool dispatchSDLEvent(SDL_Event &ev, Common::Event &event);
+
+	// Handlers for specific SDL events, called by pollEvent.
+	// This way, if a backend inherits fromt the SDL backend, it can
+	// change the behavior of only a single event, without having to override all
+	// of pollEvent.
+	virtual bool handleKeyDown(SDL_Event &ev, Common::Event &event);
+	virtual bool handleKeyUp(SDL_Event &ev, Common::Event &event);
+	virtual bool handleMouseMotion(SDL_Event &ev, Common::Event &event);
+	virtual bool handleMouseButtonDown(SDL_Event &ev, Common::Event &event);
+	virtual bool handleMouseButtonUp(SDL_Event &ev, Common::Event &event);
+	virtual bool handleJoyButtonDown(SDL_Event &ev, Common::Event &event);
+	virtual bool handleJoyButtonUp(SDL_Event &ev, Common::Event &event);
+	virtual bool handleJoyAxisMotion(SDL_Event &ev, Common::Event &event);
+
 #ifdef MIXER_DOUBLE_BUFFERING
 	SDL_mutex *_soundMutex;
 	SDL_cond *_soundCond;
@@ -255,12 +151,7 @@
 	void deinitThreadedMixer();
 #endif
 
-	FilesystemFactory *_fsFactory;
-	Common::SaveFileManager *_savefile;
-	Audio::MixerImpl *_mixer;
-
 	SDL_TimerID _timerID;
-	Common::TimerManager *_timer;
 
 	virtual void fillMouseEvent(Common::Event &event, int x, int y); // overloaded by CE backend
 	void toggleMouseGrab();


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