From 1c63cbf204b1d2c667ce9f821ccb197d0ffb0ac3 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 11 May 2011 14:48:17 +0000 Subject: Review of the main loop timer, converted timers from float to unsigned long, corrected a number of timing bugs, improved client framerate stability. --- src/core/gameinterface.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/core/gameinterface.h') diff --git a/src/core/gameinterface.h b/src/core/gameinterface.h index 369b828..d99903f 100644 --- a/src/core/gameinterface.h +++ b/src/core/gameinterface.h @@ -67,11 +67,13 @@ public: return game_interactive; } - /// return the current game time, in seconds + /** + * @brief return the current game time, in seconds. + * */ inline float time() const { - return ((float)(game_timestamp) / 1000.0f); + return (float) game_timestamp / 1000.0f; } - + /** * @brief return the current game time, in milliseconds. * 1000 milliseconds equals one second. @@ -99,7 +101,7 @@ public: /// run one game time frame /// @param timestamp current application time - virtual void frame(unsigned long timestamp) = 0; + virtual void frame(const unsigned long timestamp) = 0; protected: /// the local player @@ -108,16 +110,17 @@ protected: /// all the players Players game_players; - model::VertexArray *game_vertexarray; - /// timestamp of the time the playerlist was last changed unsigned long game_playerlist_timestamp; - void set_timestamp(unsigned long timestamp); + /// set the current game time + void set_timestamp(const unsigned long timestamp); void set_running(const bool running); void set_interactive(const bool interactive); + + model::VertexArray *game_vertexarray; private: bool game_running; -- cgit v1.2.3