From d45c12bbbb34c2e4e40d17080d888e2c7a4ea06e Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 7 Mar 2022 23:13:50 +0100 Subject: New Clock uses counters instead of epoch from now on --- Stars45/Clock.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Stars45/Clock.h') diff --git a/Stars45/Clock.h b/Stars45/Clock.h index a0b3c4f..e2ddcb0 100644 --- a/Stars45/Clock.h +++ b/Stars45/Clock.h @@ -13,21 +13,28 @@ class Clock { public: + using inner_clock = std::chrono::high_resolution_clock; + using elapsed_duration = std::chrono::milliseconds; + using count_type = elapsed_duration::rep; + Clock(); + void Set(); void Reset(); double Step(); double Delta() const; double GuiDelta() const; + double TimeCompression() const; + count_type GameTime() const; + count_type RealTime() const; void SetTimeCompression(double compression); - double TimeCompression() const; protected: - using inner_clock = std::chrono::high_resolution_clock; - inner_clock::time_point m_epoch; inner_clock::time_point m_point; + elapsed_duration m_game_elapsed; + elapsed_duration m_real_elapsed; double m_compression; double m_delta; double m_gui_delta; -- cgit v1.1