aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/manager/LoopTimerManager.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-10 09:56:22 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-10 09:56:22 +0100
commit8a3dd5ac472a0c749338ac78dd5198d3819b629f (patch)
tree4c4589ff0aca6ce761ca46845f20770e8d7de1ec /src/crepe/manager/LoopTimerManager.cpp
parent3ace1a9a7af4141715a8454d974ecd65208f405a (diff)
fixed 0 division and duplicate start
Diffstat (limited to 'src/crepe/manager/LoopTimerManager.cpp')
-rw-r--r--src/crepe/manager/LoopTimerManager.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/crepe/manager/LoopTimerManager.cpp b/src/crepe/manager/LoopTimerManager.cpp
index e496a44..1d864ad 100644
--- a/src/crepe/manager/LoopTimerManager.cpp
+++ b/src/crepe/manager/LoopTimerManager.cpp
@@ -31,10 +31,11 @@ void LoopTimerManager::update() {
if (this->delta_time > this->maximum_delta_time) {
this->delta_time = this->maximum_delta_time;
}
- if(this->delta_time.count() <= 0){
- this->delta_time = std::chrono::duration<double>(0.0);
+ if (this->delta_time.count() > 0.0) {
+ this->actual_fps = 1.0 / this->delta_time.count();
+ } else {
+ this->actual_fps = INFINITY;
}
- this->actual_fps = 1.0 / this->delta_time.count();
this->elapsed_time += this->delta_time;
this->last_frame_time = current_frame_time;