From 135402168801035c38be600fa64702c1ba63b9fe Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 27 Mar 2026 17:40:05 +0000 Subject: Use std::chrono for worldTime Defines a world time type alias, a game time scale factor (the rate at which world time progresses compare to real time) and display the world time on the status bar. --- game/environment.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'game/environment.h') diff --git a/game/environment.h b/game/environment.h index 271792f..94211bc 100644 --- a/game/environment.h +++ b/game/environment.h @@ -2,20 +2,24 @@ #include "config/types.h" #include "worldobject.h" +#include class SceneRenderer; class SceneProvider; class Environment : public WorldObject { public: + using WorldTime = std::chrono::utc_time; + Environment(); void tick(TickDuration elapsed) override; void render(const SceneRenderer &, const SceneProvider &) const; [[nodiscard]] Direction2D getSunPos() const; - [[nodiscard]] time_t getWorldTime() const; + [[nodiscard]] WorldTime getWorldTime() const; [[nodiscard]] static Direction2D getSunPos(Direction2D position, time_t time); private: - time_t worldTime; + WorldTime worldTime; + uint16_t gameTimeScaleFactor; glm::vec<2, Angle> earthPos; }; -- cgit v1.3