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

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Thu Jun 10 22:31:08 CEST 2010


Revision: 49584
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49584&view=rev
Author:   vgvgf
Date:     2010-06-10 20:31:08 +0000 (Thu, 10 Jun 2010)

Log Message:
-----------
Added ModularBackend base class for backends.

Added Paths:
-----------
    scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp
    scummvm/branches/gsoc2010-opengl/backends/modular-backend.h

Added: scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp	                        (rev 0)
+++ scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp	2010-06-10 20:31:08 UTC (rev 49584)
@@ -0,0 +1,283 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#include "backends/modular-backend.h"
+#include "gui/message.h"
+
+ModularBackend::ModularBackend()
+	:
+	_fsFactory(0),
+	_eventManager(0),
+	_savefileManager(0),
+	_timerManager(0),
+	_mutexManager(0),
+	_graphicsManager(0),
+	_mixer(0),
+	_audiocdManager(0) {
+
+}
+
+ModularBackend::~ModularBackend() {
+	delete _eventManager;
+	delete _mutexManager;
+	delete _graphicsManager;
+	delete _mixer;
+	delete _audiocdManager;
+}
+
+bool ModularBackend::hasFeature(Feature f) {
+	return _graphicsManager->hasFeature(f);
+}
+
+void ModularBackend::setFeatureState(Feature f, bool enable) {
+	return _graphicsManager->setFeatureState(f, enable);
+}
+
+bool ModularBackend::getFeatureState(Feature f) {
+	return _graphicsManager->getFeatureState(f);
+}
+
+const OSystem::GraphicsMode *ModularBackend::getSupportedGraphicsModes() const {
+	return _graphicsManager->getSupportedGraphicsModes();
+}
+
+int ModularBackend::getDefaultGraphicsMode() const {
+	return _graphicsManager->getDefaultGraphicsMode();
+}
+
+bool ModularBackend::setGraphicsMode(int mode) {
+	return _graphicsManager->setGraphicsMode(mode);
+}
+
+int ModularBackend::getGraphicsMode() const {
+	return _graphicsManager->getGraphicsMode();
+}
+
+#ifdef USE_RGB_COLOR
+Graphics::PixelFormat ModularBackend::getScreenFormat() const {
+	return _graphicsManager->getScreenFormat();
+}
+
+Common::List<Graphics::PixelFormat> ModularBackend::getSupportedFormats() {
+	return _graphicsManager->getSupportedFormats();
+}
+#endif
+
+void ModularBackend::initSize(uint w, uint h, const Graphics::PixelFormat *format ) {
+	_graphicsManager->initSize(w, h, format);
+}
+
+/** TODO: Add getScreenChangeID, beginGFXTransaction and
+ ** endGFXTransaction to graphics manager
+int ModularBackend::getScreenChangeID() const {
+	return _graphicsManager->getScreenChangeID();
+}
+
+void ModularBackend::beginGFXTransaction() {
+	_graphicsManager->beginGFXTransaction();
+}
+
+OSystem::TransactionError ModularBackend::endGFXTransaction() {
+	return _graphicsManager->endGFXTransaction();
+}*/
+
+int16 ModularBackend::getHeight() {
+	return _graphicsManager->getHeight();
+}
+
+int16 ModularBackend::getWidth() {
+	return _graphicsManager->getWidth();
+}
+
+void ModularBackend::setPalette(const byte *colors, uint start, uint num) {
+	_graphicsManager->setPalette(colors, start, num);
+}
+
+void ModularBackend::grabPalette(byte *colors, uint start, uint num) {
+	_graphicsManager->grabPalette(colors, start, num);
+}
+
+void ModularBackend::copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h) {
+	_graphicsManager->copyRectToScreen(buf, pitch, x, y, w, h);
+}
+
+Graphics::Surface *ModularBackend::lockScreen() {
+	return _graphicsManager->lockScreen();
+}
+
+void ModularBackend::unlockScreen() {
+	_graphicsManager->unlockScreen();
+}
+
+void ModularBackend::fillScreen(uint32 col) {
+	_graphicsManager->fillScreen(col);
+}
+
+void ModularBackend::updateScreen() {
+	_graphicsManager->updateScreen();
+}
+
+void ModularBackend::setShakePos(int shakeOffset) {
+	_graphicsManager->setShakePos(shakeOffset);
+}
+/** TODO: Add setFocusRectangle and clearFocusRectangle
+ ** to graphics manager
+void ModularBackend::setFocusRectangle(const Common::Rect& rect) {
+	_graphicsManager->setFocusRectangle(rect);
+}
+
+void ModularBackend::clearFocusRectangle() {
+	_graphicsManager->clearFocusRectangle();
+}*/
+
+void ModularBackend::showOverlay() {
+	_graphicsManager->showOverlay();
+}
+
+void ModularBackend::hideOverlay() {
+	_graphicsManager->hideOverlay();
+}
+
+Graphics::PixelFormat ModularBackend::getOverlayFormat() const {
+	return _graphicsManager->getOverlayFormat();
+}
+
+void ModularBackend::clearOverlay() {
+	_graphicsManager->clearOverlay();
+}
+
+void ModularBackend::grabOverlay(OverlayColor *buf, int pitch) {
+	_graphicsManager->grabOverlay(buf, pitch);
+}
+
+void ModularBackend::copyRectToOverlay(const OverlayColor *buf, int pitch, int x, int y, int w, int h) {
+	_graphicsManager->copyRectToOverlay(buf, pitch, x, y, w, h);
+}
+
+int16 ModularBackend::getOverlayHeight() {
+	return _graphicsManager->getOverlayHeight();
+}
+
+int16 ModularBackend::getOverlayWidth() {
+	return _graphicsManager->getOverlayWidth();
+}
+
+bool ModularBackend::showMouse(bool visible) {
+	return _graphicsManager->showMouse(visible);
+}
+
+void ModularBackend::warpMouse(int x, int y) {
+	_graphicsManager->warpMouse(x, y);
+}
+
+void ModularBackend::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);
+}
+
+/** TODO: Add setCursorPalette and disableCursorPalette
+ ** to graphics manager
+void ModularBackend::setCursorPalette(const byte *colors, uint start, uint num) {
+	_graphicsManager->setCursorPalette(colors, start, num);
+}
+
+void ModularBackend::disableCursorPalette(bool disable) {
+	_graphicsManager->disableCursorPalette(disable);
+}*/
+
+/** TODO: Add getMillis, delayMillis and getTimeAndDate
+ ** to timer manager
+uint32 ModularBackend::getMillis() {
+	assert(_timerManager);
+	return _timerManager->getMillis();
+}
+
+void ModularBackend::delayMillis(uint msecs) {
+	assert(_timerManager);
+	_timerManager->delayMillis(msecs);
+}
+
+void ModularBackend::getTimeAndDate(TimeDate &t) const {
+	assert(_timerManager);
+	return _timerManager->getTimeAndDate(t);
+}*/
+
+Common::TimerManager *ModularBackend::getTimerManager() {
+	assert(_timerManager);
+	return _timerManager;
+}
+
+Common::EventManager *ModularBackend::getEventManager() {
+	assert(_eventManager);
+	return _eventManager;
+}
+
+OSystem::MutexRef ModularBackend::createMutex() {
+	assert(_mutexManager);
+	return _mutexManager->createMutex();
+}
+
+void ModularBackend::lockMutex(MutexRef mutex) {
+	assert(_mutexManager);
+	_mutexManager->lockMutex(mutex);
+}
+
+void ModularBackend::unlockMutex(MutexRef mutex) {
+	assert(_mutexManager);
+	_mutexManager->unlockMutex(mutex);
+}
+
+void ModularBackend::deleteMutex(MutexRef mutex) {
+	assert(_mutexManager);
+	_mutexManager->deleteMutex(mutex);
+}
+
+Audio::Mixer *ModularBackend::getMixer() {
+	assert(_mixer);
+	return (Audio::Mixer *)_mixer;
+}
+
+AudioCDManager *ModularBackend::getAudioCD() {
+	assert(_audiocdManager);
+	return _audiocdManager;
+}
+
+void ModularBackend::displayMessageOnOSD(const char *msg) {
+#ifdef USE_OSD
+	_graphicsManager->displayMessageOnOSD(msg);
+#else
+	GUI::TimedMessageDialog dialog(msg, 1500);
+	dialog.runModal();
+#endif
+}
+
+Common::SaveFileManager *ModularBackend::getSavefileManager() {
+	assert(_savefileManager);
+	return _savefileManager;
+}
+
+FilesystemFactory *ModularBackend::getFilesystemFactory() {
+	assert(_fsFactory);
+	return _fsFactory;
+}


Property changes on: scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Added: scummvm/branches/gsoc2010-opengl/backends/modular-backend.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/modular-backend.h	                        (rev 0)
+++ scummvm/branches/gsoc2010-opengl/backends/modular-backend.h	2010-06-10 20:31:08 UTC (rev 49584)
@@ -0,0 +1,120 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+#ifndef BACKENDS_MODULAR_BACKEND_H
+#define BACKENDS_MODULAR_BACKEND_H
+
+#include "common/system.h"
+#include "backends/events/default/default-events.h"
+#include "backends/audiocd/default/default-audiocd.h"
+#include "backends/mutex/null/null-mutex.h"
+#include "backends/graphics/null/null-graphics.h"
+
+class ModularBackend : public OSystem {
+public:
+	ModularBackend();
+	virtual ~ModularBackend();
+
+	virtual bool hasFeature(Feature f);
+	virtual void setFeatureState(Feature f, bool enable);
+	virtual bool getFeatureState(Feature f);
+
+	virtual const GraphicsMode *getSupportedGraphicsModes() const;
+	virtual int getDefaultGraphicsMode() const;
+	virtual bool setGraphicsMode(int mode);
+	virtual int getGraphicsMode() const;
+#ifdef USE_RGB_COLOR
+	virtual Graphics::PixelFormat getScreenFormat() const;
+	virtual Common::List<Graphics::PixelFormat> getSupportedFormats();
+#endif
+	virtual void initSize(uint width, uint height, const Graphics::PixelFormat *format = NULL);
+	//virtual int getScreenChangeID() const;
+
+	//virtual void beginGFXTransaction();
+	//virtual OSystem::TransactionError endGFXTransaction();
+
+	virtual int16 getHeight();
+	virtual int16 getWidth();
+	virtual void setPalette(const byte *colors, uint start, uint num);
+	virtual void grabPalette(byte *colors, uint start, uint num);
+	virtual void copyRectToScreen(const byte *buf, int pitch, int x, int y, int w, int h);
+	virtual Graphics::Surface *lockScreen();
+	virtual void unlockScreen();
+	virtual void fillScreen(uint32 col);
+	virtual void updateScreen();
+	virtual void setShakePos(int shakeOffset);
+	//virtual void setFocusRectangle(const Common::Rect& rect);
+	//virtual void clearFocusRectangle();
+
+	virtual void showOverlay();
+	virtual void hideOverlay();
+	virtual Graphics::PixelFormat getOverlayFormat() const;
+	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 getOverlayHeight();
+	virtual int16 getOverlayWidth();
+
+	virtual bool showMouse(bool visible);
+	virtual void warpMouse(int x, int y);
+	virtual void setMouseCursor(const byte *buf, uint w, uint h, int hotspotX, int hotspotY, uint32 keycolor, int cursorTargetScale = 1, const Graphics::PixelFormat *format = NULL);
+	/*virtual void setCursorPalette(const byte *colors, uint start, uint num);
+	virtual void disableCursorPalette(bool disable);*/
+
+	/*virtual uint32 getMillis();
+	virtual void delayMillis(uint msecs);
+	virtual void getTimeAndDate(TimeDate &t) const;*/
+	virtual Common::TimerManager *getTimerManager();
+	virtual Common::EventManager *getEventManager();
+	virtual Common::HardwareKeySet *getHardwareKeySet() { return 0; }
+
+	virtual MutexRef createMutex();
+	virtual void lockMutex(MutexRef mutex);
+	virtual void unlockMutex(MutexRef mutex);
+	virtual void deleteMutex(MutexRef mutex);
+
+	virtual Audio::Mixer *getMixer();
+
+	virtual AudioCDManager *getAudioCD();
+
+	virtual void quit() { exit(0); }
+	virtual void setWindowCaption(const char *caption) {}
+	virtual void displayMessageOnOSD(const char *msg);
+	virtual Common::SaveFileManager *getSavefileManager();
+	virtual FilesystemFactory *getFilesystemFactory();
+
+protected:
+	FilesystemFactory *_fsFactory;
+	Common::EventManager *_eventManager;
+	Common::SaveFileManager *_savefileManager;
+	Common::TimerManager *_timerManager;
+	MutexManager *_mutexManager;
+	GraphicsManager *_graphicsManager;
+	Audio::Mixer *_mixer;
+	AudioCDManager *_audiocdManager;
+};
+
+
+#endif


Property changes on: scummvm/branches/gsoc2010-opengl/backends/modular-backend.h
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native


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