From f9269a45b82f637173e30760e1f4febc7ccb2b3e Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 11 Feb 2023 00:54:15 +0100 Subject: Clock now tracks seconds since creation --- engine/src/Clock.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'engine/src') diff --git a/engine/src/Clock.cpp b/engine/src/Clock.cpp index 5261603..956f9c4 100644 --- a/engine/src/Clock.cpp +++ b/engine/src/Clock.cpp @@ -9,23 +9,18 @@ namespace engine { -float -Clock::dt() const +Clock::Clock() { - return GetFrameTime() * time_factor; + update(); } -float -Clock::ui() const +void +Clock::update() { - return GetFrameTime(); -} - - -Clock::operator float() const -{ - return dt(); + ui = GetFrameTime(); + dt = ui * time_factor; + game += dt; } -- cgit v1.1