mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Simplify sf::Clock
usage
This commit is contained in:
parent
1e1c13b51d
commit
08cfbc7d6c
@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user