diff options
author | Stijn Buys <ingar@osirion.org> | 2011-05-11 14:48:17 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-05-11 14:48:17 +0000 |
commit | 1c63cbf204b1d2c667ce9f821ccb197d0ffb0ac3 (patch) | |
tree | c2d0ff7cc4a8a264657abd0ac99017a5b664ecd2 /src/core/application.h | |
parent | bb0f860989f84b901f80017ae0139a3fc0446dc1 (diff) |
Review of the main loop timer, converted timers from float to unsigned long,
corrected a number of timing bugs, improved client framerate stability.
Diffstat (limited to 'src/core/application.h')
-rw-r--r-- | src/core/application.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/core/application.h b/src/core/application.h index 37b70c2..cdaef67 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -8,6 +8,7 @@ #define __INCLUDED_CORE_APPLICATION_H__ #include "sys/sys.h" +#include "sys/timer.h" #include "core/commandbuffer.h" #include "core/cvar.h" @@ -30,14 +31,16 @@ public: /*----- inspectors ----------------------------------------------- */ - /// the current application time, in microseconds + /// the current application time, in milliseconds inline unsigned long timestamp() const { - return application_timestamp; + return application_timer.timestamp(); } - - /// the current application time, in seconds - float time() const { - return ((float)(timestamp()) / 1000.0f); + + /** + * @brief return the current application time, in seconds. + * */ + inline float time() const { + return (float) application_timer.timestamp() / 1000.0f; } /// true if the core is connected to a running game interface @@ -99,7 +102,7 @@ public: protected: /// run a core frame - virtual void frame(unsigned long timestamp); + virtual void frame(); /// load cvar config void load_config(); @@ -114,8 +117,8 @@ protected: void load_commandline(int count, char **argments); private: - /// time the core has been running - unsigned long application_timestamp; + /// main loop timer + sys::Timer application_timer; GameInterface *application_game; |