aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/LoopTimer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api/LoopTimer.h')
-rw-r--r--src/crepe/api/LoopTimer.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/crepe/api/LoopTimer.h b/src/crepe/api/LoopTimer.h
index b20203d..e348628 100644
--- a/src/crepe/api/LoopTimer.h
+++ b/src/crepe/api/LoopTimer.h
@@ -29,7 +29,7 @@ public:
*
* \param fps The desired frames rendered per second.
*/
- void set_fps(int fps);
+ void set_target_fps(int fps);
/**
* \brief Get the current frames per second (FPS).
@@ -62,7 +62,6 @@ private:
* Initializes the timer to begin tracking frame times.
*/
void start();
-
/**
* \brief Enforce the frame rate limit.
*
@@ -110,8 +109,10 @@ private:
void advance_fixed_update();
private:
- //! Current frames per second
- int fps = 50;
+ //! Target frames per second
+ int target_fps = 50;
+ //! Actual frames per second
+ int actual_fps = 0;
//! Current game scale
double game_scale = 1;
//! Maximum delta time in seconds to avoid large jumps
@@ -119,7 +120,7 @@ private:
//! Delta time for the current frame in seconds
std::chrono::duration<double> delta_time{0.0};
//! Target time per frame in seconds
- std::chrono::duration<double> frame_target_time = std::chrono::duration<double>(1.0) / fps;
+ std::chrono::duration<double> frame_target_time = std::chrono::duration<double>(1.0) / target_fps;
//! Fixed delta time for fixed updates in seconds
std::chrono::duration<double> fixed_delta_time = std::chrono::duration<double>(1.0) / 50.0;
//! Total elapsed game time in seconds
@@ -128,6 +129,7 @@ private:
std::chrono::duration<double> elapsed_fixed_time{0.0};
//! Time of the last frame
std::chrono::steady_clock::time_point last_frame_time;
+
};
} // namespace crepe