aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/manager/LoopTimerManager.cpp
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-11 14:33:31 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2024-12-11 14:33:31 +0100
commitdfa8ffbc03c4c1acd74fd14e54c6ee566a3c445c (patch)
tree262991f97b02e721c46f767eab7250898fe1a566 /src/crepe/manager/LoopTimerManager.cpp
parent68bf20b491b4b7673c2ece7a6497b9faffd44eb1 (diff)
make format
Diffstat (limited to 'src/crepe/manager/LoopTimerManager.cpp')
-rw-r--r--src/crepe/manager/LoopTimerManager.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/crepe/manager/LoopTimerManager.cpp b/src/crepe/manager/LoopTimerManager.cpp
index a306eb7..71a72e2 100644
--- a/src/crepe/manager/LoopTimerManager.cpp
+++ b/src/crepe/manager/LoopTimerManager.cpp
@@ -23,8 +23,7 @@ void LoopTimerManager::start() {
}
void LoopTimerManager::update() {
- TimePoint_t current_frame_time
- = std::chrono::steady_clock::now();
+ TimePoint_t current_frame_time = std::chrono::steady_clock::now();
// Convert to duration in seconds for delta time
this->delta_time = current_frame_time - last_frame_time;
@@ -40,12 +39,15 @@ void LoopTimerManager::update() {
this->last_frame_time = current_frame_time;
}
-Duration_t LoopTimerManager::get_delta_time() const {return this->delta_time * this->time_scale;}
+Duration_t LoopTimerManager::get_delta_time() const {
+ return this->delta_time * this->time_scale;
+}
ElapsedTime_t LoopTimerManager::get_elapsed_time() const { return this->elapsed_time; }
void LoopTimerManager::advance_fixed_elapsed_time() {
- this->elapsed_fixed_time += std::chrono::duration_cast<ElapsedTime_t>(this->fixed_delta_time);
+ this->elapsed_fixed_time
+ += std::chrono::duration_cast<ElapsedTime_t>(this->fixed_delta_time);
}
void LoopTimerManager::set_target_framerate(unsigned fps) {
@@ -63,8 +65,7 @@ void LoopTimerManager::set_time_scale(double value) { this->time_scale = value;
float LoopTimerManager::get_time_scale() const { return this->time_scale; }
void LoopTimerManager::enforce_frame_rate() {
- TimePoint_t current_frame_time
- = std::chrono::steady_clock::now();
+ TimePoint_t current_frame_time = std::chrono::steady_clock::now();
Duration_t frame_duration = current_frame_time - this->last_frame_time;
// Check if frame duration is less than the target frame time
if (frame_duration < this->frame_target_time) {
@@ -89,6 +90,4 @@ void LoopTimerManager::set_fixed_delta_time(float seconds) {
this->fixed_delta_time = Duration_t(seconds);
}
-Duration_t LoopTimerManager::get_fixed_delta_time() const {
- return this->fixed_delta_time;
-}
+Duration_t LoopTimerManager::get_fixed_delta_time() const { return this->fixed_delta_time; }