Created base virtual classes for backends subsystems.
Removed base-backend, it won't be needed anymore. svn-id: r49284
This commit is contained in:
parent
58a7dbe721
commit
6b3d268e23
8 changed files with 195 additions and 97 deletions
|
@ -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
|
||||
}
|
|
@ -23,20 +23,15 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef BACKENDS_BASE_BACKEND_H
|
||||
#define BACKENDS_BASE_BACKEND_H
|
||||
#ifndef BACKENDS_BASE_SUBSYS_AUDIO_H
|
||||
#define BACKENDS_BASE_SUBSYS_AUDIO_H
|
||||
|
||||
#include "common/system.h"
|
||||
#include "backends/events/default/default-events.h"
|
||||
|
||||
class BaseBackend : public OSystem, Common::EventSource {
|
||||
class BaseSubSys_Audio : public virtual OSystem {
|
||||
public:
|
||||
virtual Common::EventManager *getEventManager();
|
||||
virtual void displayMessageOnOSD(const char *msg);
|
||||
virtual void fillScreen(uint32 col);
|
||||
|
||||
virtual Common::SeekableReadStream *createConfigReadStream();
|
||||
virtual Common::WriteStream *createConfigWriteStream();
|
||||
virtual void audioInit() = 0;
|
||||
virtual void audioDone() = 0;
|
||||
};
|
||||
|
||||
|
38
backends/base-subsys-events.h
Normal file
38
backends/base-subsys-events.h
Normal file
|
@ -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
|
38
backends/base-subsys-file.h
Normal file
38
backends/base-subsys-file.h
Normal file
|
@ -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
|
38
backends/base-subsys-graphics.h
Normal file
38
backends/base-subsys-graphics.h
Normal file
|
@ -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
|
38
backends/base-subsys-mutex.h
Normal file
38
backends/base-subsys-mutex.h
Normal file
|
@ -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
|
38
backends/base-subsys-timer.h
Normal file
38
backends/base-subsys-timer.h
Normal file
|
@ -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
|
|
@ -1,7 +1,6 @@
|
|||
MODULE := backends
|
||||
|
||||
MODULE_OBJS := \
|
||||
base-backend.o \
|
||||
events/default/default-events.o \
|
||||
fs/abstract-fs.o \
|
||||
fs/stdiostream.o \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue