aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/LoopTimer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api/LoopTimer.cpp')
-rw-r--r--src/crepe/api/LoopTimer.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/crepe/api/LoopTimer.cpp b/src/crepe/api/LoopTimer.cpp
index 15011ca..07f0f75 100644
--- a/src/crepe/api/LoopTimer.cpp
+++ b/src/crepe/api/LoopTimer.cpp
@@ -13,8 +13,10 @@ LoopTimer::LoopTimer() { dbg_trace(); }
void LoopTimer::start() {
this->last_frame_time = std::chrono::steady_clock::now();
+
this->elapsed_time = std::chrono::milliseconds(0);
- this->elapsed_fixed_time = std::chrono::milliseconds(0);
+ // by starting the elapsed_fixed_time at (0 - fixed_delta_time) in milliseconds it calls a fixed update at the start of the loop.
+ this->elapsed_fixed_time = -std::chrono::duration_cast<std::chrono::milliseconds>(fixed_delta_time);
this->delta_time = std::chrono::milliseconds(0);
}