Added OSystem::getTimerManager and OSystem::getMixer methods (wip)

svn-id: r24405
This commit is contained in:
Max Horn 2006-10-21 12:03:43 +00:00
parent 772affc7db
commit f95f5ed133
5 changed files with 48 additions and 11 deletions

View File

@ -44,6 +44,7 @@
#include "gui/newgui.h"
#include "gui/message.h"
#include "sound/mididrv.h"
#include "sound/mixer.h"
#if defined(_WIN32_WCE)
#include "backends/platform/wince/CELauncherDialog.h"
@ -225,6 +226,11 @@ static int runGame(const Plugin *plugin, OSystem &system, const Common::String &
return result;
}
// FIXME: Temporary hack, to be removed soon
Audio::Mixer *g_mixer = 0;
extern "C" int scummvm_main(int argc, char *argv[]) {
Common::String specialDebug;
Common::String command;
@ -284,6 +290,8 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
// Create the timer services
Common::g_timer = new DefaultTimerManager(&system);
g_mixer = new Audio::Mixer();
// Set initial window caption
system.setWindowCaption(gScummVMFullVersion);
@ -328,6 +336,9 @@ extern "C" int scummvm_main(int argc, char *argv[]) {
launcherDialog(system);
}
// Deinit the mixer
delete g_mixer;
// Deinit the timer
delete Common::g_timer;

View File

@ -31,6 +31,7 @@
#include "common/config-manager.h"
#include "common/system.h"
#include "common/timer.h"
#include "common/util.h"
OSystem *g_system = 0;
@ -63,9 +64,22 @@ void OSystem::displayMessageOnOSD(const char *msg) {
}
Common::SaveFileManager *OSystem::getSavefileManager() {
// TODO: Change this to always return the same
// instance, instead of a new one each time around...
return new DefaultSaveFileManager();
}
Audio::Mixer *OSystem::getMixer() {
// FIXME
extern Audio::Mixer *g_mixer;
return g_mixer;
}
Common::TimerManager *OSystem::getTimerManager() {
// FIXME
return Common::g_timer;
}
bool OSystem::openCD(int drive) {
return false;

View File

@ -28,12 +28,17 @@
#include "common/mutex.h"
#include "common/rect.h"
namespace Audio {
class Mixer;
}
namespace Graphics {
struct Surface;
}
namespace Common {
class SaveFileManager;
class TimerManager;
}
/**
@ -970,6 +975,13 @@ public:
/** Savefile management. */
virtual Common::SaveFileManager *getSavefileManager();
/** TODO */
virtual Audio::Mixer *getMixer();
/** TODO */
virtual Common::TimerManager *getTimerManager();
//@}
};

View File

@ -26,32 +26,31 @@
#include "common/timer.h"
#include "common/savefile.h"
#include "common/system.h"
#include "sound/mixer.h"
#include "gui/message.h"
#include "sound/mixer.h"
#ifdef _WIN32_WCE
extern bool isSmartphone(void);
#endif
/* FIXME - BIG HACK for MidiEmu */
// FIXME - BIG HACK for MidiEmu & error()
Engine *g_engine = 0;
Engine::Engine(OSystem *syst)
: _system(syst),
_mixer(_system->getMixer()),
_timer(_system->getTimerManager()),
_saveFileMan(_system->getSavefileManager()),
_gameDataPath(ConfMan.get("path")),
_targetName(ConfMan.getActiveDomainName()){
_targetName(ConfMan.getActiveDomainName()) {
g_engine = this;
_mixer = new Audio::Mixer();
_timer = Common::g_timer;
_saveFileMan = _system->getSavefileManager();
_autosavePeriod = ConfMan.getInt("autosave_period");
}
Engine::~Engine() {
delete _mixer;
_mixer->stopAll(true);
delete _saveFileMan;
g_engine = NULL;

View File

@ -45,9 +45,10 @@ public:
Common::TimerManager * _timer;
protected:
Common::SaveFileManager *_saveFileMan;
const Common::String _targetName; // target name for saves
const Common::String _gameDataPath;
Common::SaveFileManager *_saveFileMan;
private:
int _autosavePeriod;