From 2ab9e650f814d47e78fc95500605b4561922893d Mon Sep 17 00:00:00 2001 From: Mel Date: Tue, 9 Apr 2024 03:29:14 +0200 Subject: Add FPS limiting for render thread --- src/Time.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Time.cpp') 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; } -- cgit 1.4.1