aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2009-01-30 03:35:47 +0000
committerMax Horn2009-01-30 03:35:47 +0000
commitc69ebfd798777fa5db487fe321af274d26baaf3b (patch)
tree799a2a0234e594abc7bc96c5ba1a646571bb06b6 /common
parent1d097d9791b99b78790d68133a4ecf07057a28e6 (diff)
downloadscummvm-rg350-c69ebfd798777fa5db487fe321af274d26baaf3b.tar.gz
scummvm-rg350-c69ebfd798777fa5db487fe321af274d26baaf3b.tar.bz2
scummvm-rg350-c69ebfd798777fa5db487fe321af274d26baaf3b.zip
Moved default implementations for various OSystem methods into a new class BaseBackend
svn-id: r36135
Diffstat (limited to 'common')
-rw-r--r--common/mutex.h3
-rw-r--r--common/system.cpp63
-rw-r--r--common/system.h30
3 files changed, 11 insertions, 85 deletions
diff --git a/common/mutex.h b/common/mutex.h
index 236d75d958..ba5c45c30e 100644
--- a/common/mutex.h
+++ b/common/mutex.h
@@ -27,6 +27,7 @@
#define COMMON_MUTEX_H
#include "common/scummsys.h"
+#include "common/system.h"
namespace Common {
@@ -35,7 +36,7 @@ class Mutex;
/**
* An pseudo-opaque mutex type. See OSystem::createMutex etc. for more details.
*/
-typedef struct OpaqueMutex *MutexRef;
+typedef OSystem::MutexRef MutexRef;
/**
diff --git a/common/system.cpp b/common/system.cpp
index d8dd177a02..387e0dfa0f 100644
--- a/common/system.cpp
+++ b/common/system.cpp
@@ -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
-}
diff --git a/common/system.h b/common/system.h
index 447feeebe5..505ddb5dc4 100644
--- a/common/system.h
+++ b/common/system.h
@@ -27,7 +27,6 @@
#define COMMON_SYSTEM_H
#include "common/scummsys.h"
-#include "common/mutex.h"
#include "common/noncopyable.h"
#include "common/rect.h"
@@ -515,7 +514,7 @@ public:
/**
* Clear the screen to black.
*/
- virtual void clearScreen();
+ virtual void clearScreen() = 0;
/**
* Flush the whole screen, that is render the current content of the screen
@@ -697,17 +696,6 @@ public:
/** @name Events and Time */
//@{
-protected:
- friend class DefaultEventManager;
-
- /**
- * Get the next event in the event queue.
- * @param event point to an Common::Event struct, which will be filled with the event data.
- * @return true if an event was retrieved.
- */
- virtual bool pollEvent(Common::Event &event) = 0;
-
-public:
/** Get the number of milliseconds since the program was started. */
virtual uint32 getMillis() = 0;
@@ -731,7 +719,7 @@ public:
* Return the event manager singleton. For more information, refer
* to the EventManager documentation.
*/
- virtual Common::EventManager *getEventManager();
+ virtual Common::EventManager *getEventManager() = 0;
//@}
@@ -754,7 +742,7 @@ public:
*/
//@{
- typedef Common::MutexRef MutexRef;
+ typedef struct OpaqueMutex *MutexRef;
/**
* Create a new mutex.
@@ -831,17 +819,17 @@ public:
* @param start_frame the frame at which playback should start (75 frames = 1 second).
* @param duration the number of frames to play.
*/
- virtual void playCD(int track, int num_loops, int start_frame, int duration);
+ virtual void playCD(int track, int num_loops, int start_frame, int duration) {}
/**
* Stop audio CD playback.
*/
- virtual void stopCD();
+ virtual void stopCD() {}
/**
* Update cdrom audio status.
*/
- virtual void updateCD();
+ virtual void updateCD() {}
//@}
@@ -875,7 +863,7 @@ public:
*
* @param msg the message to display on screen
*/
- virtual void displayMessageOnOSD(const char *msg);
+ virtual void displayMessageOnOSD(const char *msg) = 0;
/**
* Return the SaveFileManager, used to store and load savestates
@@ -908,7 +896,7 @@ public:
* ReadStream instance. It is the callers responsiblity to delete
* the stream after use.
*/
- virtual Common::SeekableReadStream *createConfigReadStream();
+ virtual Common::SeekableReadStream *createConfigReadStream() = 0;
/**
* Open the default config file for writing, by returning a suitable
@@ -917,7 +905,7 @@ public:
*
* May return 0 to indicate that writing to config file is not possible.
*/
- virtual Common::WriteStream *createConfigWriteStream();
+ virtual Common::WriteStream *createConfigWriteStream() = 0;
//@}
};