diff options
| author | Mel <einebeere@gmail.com> | 2024-04-09 03:29:14 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2024-04-09 03:29:14 +0200 |
| commit | 2ab9e650f814d47e78fc95500605b4561922893d (patch) | |
| tree | 1850dcdd1e198d8ca77b2677b5f1721757e16441 /src/Time.cpp | |
| parent | 15237a469afe1fd6a6958466bae761ec68b647dc (diff) | |
| download | meowcraft-2ab9e650f814d47e78fc95500605b4561922893d.tar.zst meowcraft-2ab9e650f814d47e78fc95500605b4561922893d.zip | |
Add FPS limiting for render thread
Diffstat (limited to 'src/Time.cpp')
| -rw-r--r-- | src/Time.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Time.cpp b/src/Time.cpp index 1953fed..a9608cc 100644 --- a/src/Time.cpp +++ b/src/Time.cpp @@ -12,7 +12,6 @@ void Time::start_frame() { void Time::end_frame() { auto frame_end = now(); m_delta = TO(Real, frame_end - m_current_frame_start) / 1000.0; - m_delta = std::clamp(m_delta, delta_min, delta_max); m_total_frames++; } @@ -26,6 +25,10 @@ Time::Tick Time::tick() const { } Real Time::delta() const { + return std::clamp(m_delta, delta_min, delta_max); +} + +Real Time::delta_raw() const { return m_delta; } |
