Moved default implementations for various OSystem methods into a new class BaseBackend

svn-id: r36135
This commit is contained in:
Max Horn 2009-01-30 03:35:47 +00:00
parent 1d097d9791
commit c69ebfd798
20 changed files with 188 additions and 141 deletions

View file

@ -23,9 +23,7 @@
*
*/
#include "backends/events/default/default-events.h"
#include "common/system.h"
#include "gui/message.h"
OSystem *g_system = 0;
@ -56,13 +54,6 @@ bool OSystem::setGraphicsMode(const char *name) {
return false;
}
void OSystem::displayMessageOnOSD(const char *msg) {
// Display the message for 1.5 seconds
GUI::TimedMessageDialog dialog(msg, 1500);
dialog.runModal();
}
bool OSystem::openCD(int drive) {
return false;
}
@ -70,57 +61,3 @@ bool OSystem::openCD(int drive) {
bool OSystem::pollCD() {
return false;
}
void OSystem::playCD(int track, int num_loops, int start_frame, int duration) {
}
void OSystem::stopCD() {
}
void OSystem::updateCD() {
}
static Common::EventManager *s_eventManager = 0;
Common::EventManager *OSystem::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 OSystem::clearScreen() {
Graphics::Surface *screen = lockScreen();
if (screen && screen->pixels)
memset(screen->pixels, 0, 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)
#define DEFAULT_CONFIG_FILE ".scummvmrc"
#else
#define DEFAULT_CONFIG_FILE "scummvm.ini"
#endif
Common::SeekableReadStream *OSystem::createConfigReadStream() {
Common::FSNode file(DEFAULT_CONFIG_FILE);
return file.createReadStream();
}
Common::WriteStream *OSystem::createConfigWriteStream() {
#ifdef __DC__
return 0;
#else
Common::FSNode file(DEFAULT_CONFIG_FILE);
return file.createWriteStream();
#endif
}