aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/crepe/api/LoopManager.cpp2
-rw-r--r--src/crepe/manager/LoopTimerManager.cpp2
-rw-r--r--src/crepe/manager/LoopTimerManager.h28
3 files changed, 19 insertions, 13 deletions
diff --git a/src/crepe/api/LoopManager.cpp b/src/crepe/api/LoopManager.cpp
index 9bb2183..492b982 100644
--- a/src/crepe/api/LoopManager.cpp
+++ b/src/crepe/api/LoopManager.cpp
@@ -47,7 +47,7 @@ void LoopManager::loop() {
while (game_running) {
this->loop_timer.update();
- while (this->loop_timer.get_lag() >= this->loop_timer.get_fixed_loop_interval()) {
+ while (this->loop_timer.get_lag() >= this->loop_timer.get_fixed_delta_time()) {
this->process_input();
this->fixed_update();
this->loop_timer.advance_fixed_update();
diff --git a/src/crepe/manager/LoopTimerManager.cpp b/src/crepe/manager/LoopTimerManager.cpp
index 366d48a..d2e40fe 100644
--- a/src/crepe/manager/LoopTimerManager.cpp
+++ b/src/crepe/manager/LoopTimerManager.cpp
@@ -92,6 +92,6 @@ void LoopTimerManager::set_fixed_delta_time(double seconds) {
this->fixed_delta_time = std::chrono::duration<double>(seconds);
}
-double LoopTimerManager::get_fixed_loop_interval() const {
+double LoopTimerManager::get_fixed_delta_time() const {
return this->fixed_delta_time.count();
}
diff --git a/src/crepe/manager/LoopTimerManager.h b/src/crepe/manager/LoopTimerManager.h
index 5a9eda8..46a0dcb 100644
--- a/src/crepe/manager/LoopTimerManager.h
+++ b/src/crepe/manager/LoopTimerManager.h
@@ -22,7 +22,10 @@ public:
LoopTimerManager(Mediator &mediator);
/**
* \brief Get the current delta time for the current frame.
- *
+ *
+ * This value represents the estimated frame duration of the current frame.
+ * This value can be used in the frame_update to convert pixel based values to time based values.
+ *
* \return Delta time in seconds since the last frame.
*/
double get_delta_time() const;
@@ -73,19 +76,10 @@ public:
*
* This value is used in the LoopManager to determine how many times
* the fixed_update should be called within a given interval.
+ * This value is also the timing value which is used in the fixed_loop to convert pixels to time.
*
* \return The unscaled fixed delta time in seconds.
*/
- double get_fixed_loop_interval() const;
-
- /**
- * \brief Get the scaled fixed delta time in seconds.
- *
- * The fixed delta time is used for operations that require uniform time steps,
- * such as physics calculations, and is scaled by the current time scale.
- *
- * \return The fixed delta time, scaled by time scale, in seconds.
- */
double get_fixed_delta_time() const;
/**
@@ -94,9 +88,21 @@ public:
* \param seconds fixed_delta_time in seconds.
*
* The fixed_delta_time value is used to determine how many times per second the fixed_update and process_input functions are called.
+ * This value is also the timing value which is used in the fixed_loop to convert pixels to time.
*/
void set_fixed_delta_time(double seconds);
+ /**
+ * \brief Retrieves the scaled fixed delta time in seconds.
+ *
+ * The scaled fixed delta time is the timing value used within the `fixed_update` function.
+ * It is adjusted by the time_scale to account for any changes in the simulation's
+ * speed.
+ *
+ * \return The fixed delta time, scaled by the current time scale, in seconds.
+ */
+ double get_scaled_fixed_delta_time() const;
+
private:
//! Friend relation to use start,enforce_frame_rate,get_lag,update,advance_fixed_update.
friend class LoopManager;