Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/module.h')
-rw-r--r--src/core/module.h34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/core/module.h b/src/core/module.h
index bc4f765..64b41bd 100644
--- a/src/core/module.h
+++ b/src/core/module.h
@@ -17,7 +17,7 @@ namespace core
class Module
{
public:
- Module(const char *label, const char *name);
+ Module(const char *label, const char *name, bool interactive=true);
virtual ~Module();
/*----- inspectors ------------------------------------------------ */
@@ -38,11 +38,11 @@ public:
/*----- mutators -------------------------------------------------- */
- /// initialize the game module
- virtual void init() = 0;
+ /// run the game module
+ void run();
- /// shutdown the game module
- virtual void shutdown() = 0;
+ /// terminate a running game module
+ void terminate();
/// run one timeframe
virtual void frame(float seconds) = 0;
@@ -75,27 +75,39 @@ public:
/// unload all modules
static void clear();
+ /// currently active module
+ static inline Module *active() { return module_active; }
+
/// currently loaded module
- static inline Module *current() { return module_preload; }
+ static inline Module *loaded() { return module_preload; }
/// module registry
static inline Registry & registry() { return module_registry; }
protected:
- /// set the disconnected state
+ /// initialize the game module
+ virtual void init() = 0;
+
+ /// shutdown the game module
+ virtual void shutdown() = 0;
+
+ /// abort a running module
void abort();
- bool module_running;
+private:
+
bool module_interactive;
+ bool module_running;
-private:
std::string module_label;
std::string module_name;
- static Module *module_preload;
-
static Registry module_registry;
+
+ static Module *module_preload;
+ static Module *module_active;
+
};
}