Simplify sf::Clock usage

This commit is contained in:
Chris Thrasher 2024-05-28 05:18:33 +00:00
parent 1e1c13b51d
commit 08cfbc7d6c
2 changed files with 2 additions and 4 deletions

View File

@ -187,8 +187,7 @@ void Window::display()
// Limit the framerate if needed // Limit the framerate if needed
if (m_frameTimeLimit != Time::Zero) if (m_frameTimeLimit != Time::Zero)
{ {
sleep(m_frameTimeLimit - m_clock.getElapsedTime()); sleep(m_frameTimeLimit - m_clock.restart());
m_clock.restart();
} }
} }

View File

@ -258,8 +258,7 @@ void EaglContext::display()
if (m_vsyncEnabled) if (m_vsyncEnabled)
{ {
constexpr Time frameDuration = seconds(1.f / 60.f); constexpr Time frameDuration = seconds(1.f / 60.f);
sleep(frameDuration - m_clock.getElapsedTime()); sleep(frameDuration - m_clock.restart());
m_clock.restart();
} }
} }