summaryrefslogtreecommitdiff
path: root/game/environment.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-27 17:40:05 +0000
committerDan Goodliffe <dan.goodliffe@octal.co.uk>2026-03-27 17:40:05 +0000
commit135402168801035c38be600fa64702c1ba63b9fe (patch)
tree36f13d91fc08b0f0cb395fa648bde777c8c76773 /game/environment.h
parentAdd wrapper for ImGui::TextEx for any contiguous char range (diff)
downloadilt-135402168801035c38be600fa64702c1ba63b9fe.tar.bz2
ilt-135402168801035c38be600fa64702c1ba63b9fe.tar.xz
ilt-135402168801035c38be600fa64702c1ba63b9fe.zip
Use std::chrono for worldTimeHEADmain
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.
Diffstat (limited to 'game/environment.h')
-rw-r--r--game/environment.h8
1 files changed, 6 insertions, 2 deletions
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 <chrono>
class SceneRenderer;
class SceneProvider;
class Environment : public WorldObject {
public:
+ using WorldTime = std::chrono::utc_time<std::chrono::seconds>;
+
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;
};