diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/crepe/api/LoopManager.cpp | 1 | ||||
-rw-r--r-- | src/crepe/api/LoopManager.h | 9 | ||||
-rw-r--r-- | src/crepe/manager/LoopTimerManager.cpp | 6 | ||||
-rw-r--r-- | src/crepe/manager/LoopTimerManager.h | 10 |
4 files changed, 13 insertions, 13 deletions
diff --git a/src/crepe/api/LoopManager.cpp b/src/crepe/api/LoopManager.cpp index 69cbfaf..42a1e77 100644 --- a/src/crepe/api/LoopManager.cpp +++ b/src/crepe/api/LoopManager.cpp @@ -1,4 +1,3 @@ -#include <iostream> #include "../facade/SDLContext.h" #include "../manager/EventManager.h" diff --git a/src/crepe/api/LoopManager.h b/src/crepe/api/LoopManager.h index 00f5409..d07ef66 100644 --- a/src/crepe/api/LoopManager.h +++ b/src/crepe/api/LoopManager.h @@ -94,13 +94,14 @@ private: ComponentManager component_manager{mediator}; //! Scene manager instance SceneManager scene_manager{mediator}; - - //! SDL context \todo no more singletons! - SDLContext & sdl_context = SDLContext::get_instance(); - //! LoopTimer instance + //! LoopTimerManager instance LoopTimerManager loop_timer{mediator}; //! EventManager instance EventManager event_manager{mediator}; + + //! SDL context \todo no more singletons! + SDLContext & sdl_context = SDLContext::get_instance(); + private: /** diff --git a/src/crepe/manager/LoopTimerManager.cpp b/src/crepe/manager/LoopTimerManager.cpp index 8156c6d..2379fdd 100644 --- a/src/crepe/manager/LoopTimerManager.cpp +++ b/src/crepe/manager/LoopTimerManager.cpp @@ -38,7 +38,7 @@ void LoopTimerManager::update() { this->last_frame_time = current_frame_time; } -double LoopTimerManager::get_delta_time() const { return this->delta_time.count() * this->game_scale; } +double LoopTimerManager::get_delta_time() const { return this->delta_time.count() * this->time_scale; } double LoopTimerManager::get_current_time() const { return this->elapsed_time.count(); } @@ -54,9 +54,9 @@ void LoopTimerManager::set_target_fps(int fps) { int LoopTimerManager::get_fps() const { return this->actual_fps; } -void LoopTimerManager::set_time_scale(double value) { this->game_scale = value; } +void LoopTimerManager::set_time_scale(double value) { this->time_scale = value; } -double LoopTimerManager::get_time_scale() const { return this->game_scale; } +double LoopTimerManager::get_time_scale() const { return this->time_scale; } void LoopTimerManager::enforce_frame_rate() { auto current_frame_time = std::chrono::steady_clock::now(); auto frame_duration = current_frame_time - this->last_frame_time; diff --git a/src/crepe/manager/LoopTimerManager.h b/src/crepe/manager/LoopTimerManager.h index fee6310..cd05bf2 100644 --- a/src/crepe/manager/LoopTimerManager.h +++ b/src/crepe/manager/LoopTimerManager.h @@ -51,7 +51,7 @@ public: /** * \brief Get the current time scale. * - * \return The current time scale, where 0 = paused, 1 = normal speed, and values > 1 speed + * \return The current time scale, where (0 = pause, < 1 = slow down, 1 = normal speed, > 1 = speed up). * up the game. */ double get_time_scale() const; @@ -61,9 +61,9 @@ public: * * time_scale is a value that changes the delta time that can be retrieved using get_delta_time function. * - * \param game_scale The desired time scale (0 = pause, 1 = normal speed, > 1 = speed up). + * \param time_scale The desired time scale (0 = pause, < 1 = slow down, 1 = normal speed, > 1 = speed up). */ - void set_time_scale(double game_scale); + void set_time_scale(double time_scale); private: friend class LoopManager; @@ -123,8 +123,8 @@ private: int target_fps = 50; //! Actual frames per second int actual_fps = 0; - //! Current game scale - double game_scale = 1; + //! time scale for speeding up or slowing down the game (0 = pause, < 1 = slow down, 1 = normal speed, > 1 = speed up) + double time_scale = 1; //! Maximum delta time in seconds to avoid large jumps std::chrono::duration<double> maximum_delta_time{0.25}; //! Delta time for the current frame in seconds |