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-02-18 17:52:15 +0000
committerStijn Buys <ingar@osirion.org>2008-02-18 17:52:15 +0000
commit0b8582a9aa825024edbd0a21c6287bfcccec28de (patch)
tree2d9a46c60b028300b1b9133b84764b6c39964c33 /src/core/application.h
parent982562fa19bb87a3dab352e562f386f61c171b7b (diff)
core redesign, part II
Diffstat (limited to 'src/core/application.h')
-rw-r--r--src/core/application.h65
1 files changed, 33 insertions, 32 deletions
diff --git a/src/core/application.h b/src/core/application.h
index 0f4c5fa..de0ab35 100644
--- a/src/core/application.h
+++ b/src/core/application.h
@@ -25,35 +25,18 @@ public:
/// default destructor
virtual ~Application();
- /// initialize the application
- virtual void init();
-
- /// shutdown the application
- virtual void shutdown();
-
- /// a pointer to the current application instance
- static Application *instance();
-
- /// time the has been connected, in seconds
- float time() const;
-
- /// preloaded game object
- GameInterface *gameinterface_preload;
-
- /// true if the core is connected to a game module or a remote server
- bool connected() const;
+/*----- inspectors ----------------------------------------------- */
- /// network server instance
- NetServer *netserver;
-
- /// network client to server connection
- NetConnection netconnection;
+ /// time the application has been running
+ inline float time() const { return application_time; }
- /// global application object
- static Application *application_instance;
+ /// true if the core is connected to a running game interface
+ inline bool connected() const { return (application_game && application_game->running()); }
- /// quit the application without proper shutdown
- virtual void quit(int status);
+ /// return the game interface, returns 0 if the pplication is not connected to a game
+ inline GameInterface *game() { return application_game; }
+
+/*----- mutators ------------------------------------------------- */
/// start the server or connect to remote host
void connect(std::string const &host);
@@ -61,20 +44,38 @@ public:
/// disconnect from the game module
void disconnect();
-protected:
- /// clear all game related objects
- void clear();
+/*----- virtual mutators ------------------------------------------ */
+ /// initialize the application
+ virtual void init();
+
+ /// shutdown the application
+ virtual void shutdown();
+
+ /// quit the application without proper shutdown
+ virtual void quit(int status);
+
+/*----- static --------------------------------------------------- */
+
+ /// a pointer to the current application instance
+ static inline Application *instance() { return application_instance; }
+
+protected:
/// run a core frame
virtual void frame(float seconds);
private:
/// time the core has been running
- float game_time;
+ float application_time;
+ GameInterface *application_game;
+ static Application *application_instance;
};
-/// pointer to the current ApplicationInterface
-Application *application();
+/// pointer to the current Application
+inline Application *application() { return Application::instance(); }
+
+/// pointer to the current GameInterface
+inline GameInterface *game() { return Application::instance()->game(); }
} // namespace core