Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-10-18 17:58:45 +0000
committerStijn Buys <ingar@osirion.org>2008-10-18 17:58:45 +0000
commit35613f0860a2d8cb643ca8de006de08503e48e53 (patch)
tree8a5436de643e818e68a82df2e5cb2df2145f5062 /src/core/module.h
parentdb287e4a5133125bb6f25ba21ea97c47b19ac67f (diff)
example module
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;
+
};
}