From 6b3d268e23713eba0356599e8ac6e926e3315148 Mon Sep 17 00:00:00 2001 From: Alejandro Marzini Date: Fri, 28 May 2010 05:03:32 +0000 Subject: Created base virtual classes for backends subsystems. Removed base-backend, it won't be needed anymore. svn-id: r49284 --- backends/base-backend.cpp | 86 ----------------------------------------- backends/base-backend.h | 43 --------------------- backends/base-subsys-audio.h | 38 ++++++++++++++++++ backends/base-subsys-events.h | 38 ++++++++++++++++++ backends/base-subsys-file.h | 38 ++++++++++++++++++ backends/base-subsys-graphics.h | 38 ++++++++++++++++++ backends/base-subsys-mutex.h | 38 ++++++++++++++++++ backends/base-subsys-timer.h | 38 ++++++++++++++++++ backends/module.mk | 1 - 9 files changed, 228 insertions(+), 130 deletions(-) delete mode 100644 backends/base-backend.cpp delete mode 100644 backends/base-backend.h create mode 100644 backends/base-subsys-audio.h create mode 100644 backends/base-subsys-events.h create mode 100644 backends/base-subsys-file.h create mode 100644 backends/base-subsys-graphics.h create mode 100644 backends/base-subsys-mutex.h create mode 100644 backends/base-subsys-timer.h (limited to 'backends') diff --git a/backends/base-backend.cpp b/backends/base-backend.cpp deleted file mode 100644 index c06695a727..0000000000 --- a/backends/base-backend.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* 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/base-backend.h" -#include "backends/events/default/default-events.h" -#include "gui/message.h" - -void BaseBackend::displayMessageOnOSD(const char *msg) { - // Display the message for 1.5 seconds - GUI::TimedMessageDialog dialog(msg, 1500); - dialog.runModal(); -} - - -static Common::EventManager *s_eventManager = 0; - -Common::EventManager *BaseBackend::getEventManager() { - // FIXME/TODO: Eventually this method should be turned into an abstract one, - // to force backends to implement this conciously (even if they - // end up returning the default event manager anyway). - if (!s_eventManager) - s_eventManager = new DefaultEventManager(this); - return s_eventManager; -} - -void BaseBackend::fillScreen(uint32 col) { - Graphics::Surface *screen = lockScreen(); - if (screen && screen->pixels) - memset(screen->pixels, col, screen->h * screen->pitch); - unlockScreen(); -} - - -/* - FIXME: Maybe we should push the default config file loading/saving code below - out to all the backends? -*/ - - -#if defined(UNIX) -#if defined(SAMSUNGTV) -#define DEFAULT_CONFIG_FILE "/dtv/usb/sda1/.scummvmrc" -#else -#define DEFAULT_CONFIG_FILE ".scummvmrc" -#endif -#endif - -#if !defined(UNIX) -#define DEFAULT_CONFIG_FILE "scummvm.ini" -#endif - -Common::SeekableReadStream *BaseBackend::createConfigReadStream() { - Common::FSNode file(DEFAULT_CONFIG_FILE); - return file.createReadStream(); -} - -Common::WriteStream *BaseBackend::createConfigWriteStream() { -#ifdef __DC__ - return 0; -#else - Common::FSNode file(DEFAULT_CONFIG_FILE); - return file.createWriteStream(); -#endif -} diff --git a/backends/base-backend.h b/backends/base-backend.h deleted file mode 100644 index 3fcca9c3b7..0000000000 --- a/backends/base-backend.h +++ /dev/null @@ -1,43 +0,0 @@ -/* 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_BASE_BACKEND_H -#define BACKENDS_BASE_BACKEND_H - -#include "common/system.h" -#include "backends/events/default/default-events.h" - -class BaseBackend : public OSystem, Common::EventSource { -public: - virtual Common::EventManager *getEventManager(); - virtual void displayMessageOnOSD(const char *msg); - virtual void fillScreen(uint32 col); - - virtual Common::SeekableReadStream *createConfigReadStream(); - virtual Common::WriteStream *createConfigWriteStream(); -}; - - -#endif diff --git a/backends/base-subsys-audio.h b/backends/base-subsys-audio.h new file mode 100644 index 0000000000..e3d3a06c01 --- /dev/null +++ b/backends/base-subsys-audio.h @@ -0,0 +1,38 @@ +/* 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_BASE_SUBSYS_AUDIO_H +#define BACKENDS_BASE_SUBSYS_AUDIO_H + +#include "common/system.h" + +class BaseSubSys_Audio : public virtual OSystem { +public: + virtual void audioInit() = 0; + virtual void audioDone() = 0; +}; + + +#endif diff --git a/backends/base-subsys-events.h b/backends/base-subsys-events.h new file mode 100644 index 0000000000..fc94fd054c --- /dev/null +++ b/backends/base-subsys-events.h @@ -0,0 +1,38 @@ +/* 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_BASE_SUBSYS_EVENTS_H +#define BACKENDS_BASE_SUBSYS_EVENTS_H + +#include "common/system.h" + +class BaseSubSys_Events : public virtual OSystem { +public: + virtual void eventsInit() = 0; + virtual void eventsDone() = 0; +}; + + +#endif diff --git a/backends/base-subsys-file.h b/backends/base-subsys-file.h new file mode 100644 index 0000000000..98b16c0c63 --- /dev/null +++ b/backends/base-subsys-file.h @@ -0,0 +1,38 @@ +/* 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_BASE_SUBSYS_FILE_H +#define BACKENDS_BASE_SUBSYS_FILE_H + +#include "common/system.h" + +class BaseSubSys_File : public virtual OSystem { +public: + virtual void fileInit() = 0; + virtual void fileDone() = 0; +}; + + +#endif diff --git a/backends/base-subsys-graphics.h b/backends/base-subsys-graphics.h new file mode 100644 index 0000000000..94acecfd17 --- /dev/null +++ b/backends/base-subsys-graphics.h @@ -0,0 +1,38 @@ +/* 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_BASE_SUBSYS_GRAPHICS_H +#define BACKENDS_BASE_SUBSYS_GRAPHICS_H + +#include "common/system.h" + +class BaseSubSys_Graphics : public virtual OSystem { +public: + virtual void graphicsInit() = 0; + virtual void graphicsDone() = 0; +}; + + +#endif diff --git a/backends/base-subsys-mutex.h b/backends/base-subsys-mutex.h new file mode 100644 index 0000000000..4a991ba438 --- /dev/null +++ b/backends/base-subsys-mutex.h @@ -0,0 +1,38 @@ +/* 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_BASE_SUBSYS_MUTEX_H +#define BACKENDS_BASE_SUBSYS_MUTEX_H + +#include "common/system.h" + +class BaseSubSys_Mutex : public virtual OSystem { +public: + virtual void mutexInit() = 0; + virtual void mutexDone() = 0; +}; + + +#endif diff --git a/backends/base-subsys-timer.h b/backends/base-subsys-timer.h new file mode 100644 index 0000000000..c857c49d41 --- /dev/null +++ b/backends/base-subsys-timer.h @@ -0,0 +1,38 @@ +/* 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_BASE_SUBSYS_TIMER_H +#define BACKENDS_BASE_SUBSYS_TIMER_H + +#include "common/system.h" + +class BaseSubSys_Timer : public virtual OSystem { +public: + virtual void timerInit() = 0; + virtual void timerDone() = 0; +}; + + +#endif diff --git a/backends/module.mk b/backends/module.mk index 59df56b468..b0b7deaac3 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -1,7 +1,6 @@ MODULE := backends MODULE_OBJS := \ - base-backend.o \ events/default/default-events.o \ fs/abstract-fs.o \ fs/stdiostream.o \ -- cgit v1.2.3