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/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