diff options
Diffstat (limited to 'engines/engine.h')
-rw-r--r-- | engines/engine.h | 105 |
1 files changed, 66 insertions, 39 deletions
diff --git a/engines/engine.h b/engines/engine.h index 81e4e6187c..dec85885d8 100644 --- a/engines/engine.h +++ b/engines/engine.h @@ -25,9 +25,9 @@ #ifndef ENGINES_ENGINE_H #define ENGINES_ENGINE_H +#include "common/scummsys.h" #include "common/events.h" #include "common/fs.h" -#include "common/scummsys.h" #include "common/str.h" class OSystem; @@ -45,7 +45,16 @@ namespace GUI { class Dialog; } -using GUI::Dialog; +/** + * Setup the backend's graphics mode. + */ +void initCommonGFX(bool defaultTo1XScaler); + +/** + * Initialized graphics and shows error message. + */ +void GUIErrorMessage(const Common::String msg); + class Engine { public: @@ -57,20 +66,15 @@ protected: Common::EventManager *_eventMan; Common::SaveFileManager *_saveFileMan; - Dialog *_mainMenuDialog; - virtual int runDialog(Dialog &dialog); + GUI::Dialog *_mainMenuDialog; + virtual int runDialog(GUI::Dialog &dialog); const Common::String _targetName; // target name for saves - const Common::FilesystemNode _gameDataDir; + const Common::FSNode _gameDataDir; private: /** - * The autosave interval, given in second. Used by shouldPerformAutoSave. - */ - int _autosavePeriod; - - /** * The pause level, 0 means 'running', a positive value indicates * how often the engine has been paused (and hence how often it has * to be un-paused before it resumes running). This makes it possible @@ -79,6 +83,13 @@ private: int _pauseLevel; public: + + /** @name Overloadable methods + * + * All Engine subclasses should consider overloading some or all of the following methods. + */ + //@{ + Engine(OSystem *syst); virtual ~Engine(); @@ -96,7 +107,9 @@ public: */ virtual int go() = 0; - /** Specific for each engine: prepare error string. */ + /** + * Prepare an error string, which is printed by the error() function. + */ virtual void errorString(const char *buf_input, char *buf_output); /** @@ -106,6 +119,39 @@ public: virtual GUI::Debugger *getDebugger() { return 0; } /** + * Notify the engine that the sound settings in the config manager may have + * changed and that it hence should adjust any internal volume etc. values + * accordingly. + * @todo find a better name for this + */ + virtual void syncSoundSettings(); + +protected: + + /** + * Actual implementation of pauseEngine by subclasses. See there + * for details. + */ + virtual void pauseEngineIntern(bool pause); + + //@} + + +public: + + /** + * Request the engine to quit. Sends a EVENT_QUIT event to the Event + * Manager. + */ + void quitGame(); + + /** + * Return whether the ENGINE should quit respectively should return to the + * launcher. + */ + bool shouldQuit() const { return (_eventMan->shouldQuit() || _eventMan->shouldRTL()); } + + /** * Pause or resume the engine. This should stop/resume any audio playback * and other stuff. Called right before the system runs a global dialog * (like a global pause, main menu, options or 'confirm exit' dialog). @@ -119,51 +165,32 @@ public: void pauseEngine(bool pause); /** - * Quit the engine, sends a Quit event to the Event Manager - */ - void quitGame(); - - /** * Return whether the engine is currently paused or not. */ bool isPaused() const { return _pauseLevel != 0; } /** - * Return whether or not the ENGINE should quit - */ - bool quit() const { return (_eventMan->shouldQuit() || _eventMan->shouldRTL()); } - - /** Run the Global Main Menu Dialog - */ - virtual void mainMenuDialog(); - - /** Sync the engine's sound settings with the config manager + * Run the Global Main Menu Dialog */ - virtual void syncSoundSettings(); + void openMainMenuDialog(); - /** Determine whether the engine supports the specified MetaEngine feature + /** + * Determine whether the engine supports the specified MetaEngine feature. */ - virtual bool hasFeature(int f); + bool hasFeature(int f); public: - /** Setup the backend's graphics mode. */ - void initCommonGFX(bool defaultTo1XScaler); - /** On some systems, check if the game appears to be run from CD. */ void checkCD(); - /** Indicate whether an autosave should be performed. */ - bool shouldPerformAutoSave(int lastSaveTime); - - /** Initialized graphics and shows error message. */ - void GUIErrorMessage(const Common::String msg); +protected: /** - * Actual implementation of pauseEngine by subclasses. See there - * for details. + * Indicate whether an autosave should be performed. */ - virtual void pauseEngineIntern(bool pause); + bool shouldPerformAutoSave(int lastSaveTime); + }; extern Engine *g_engine; |