Hello. I have implemented a fixed timestep. The problem with this is that my CPU usually goes to about 30-40% and I don't understand why. A solution would be to just use the setFramerateLimit method or vsync, but I don't understand why would I need a fixed timestep if I use one of those. If someone can shed some light here that would be much appreciated.
const sf::Time m_frameTime = sf::seconds(1.f/60.f);
sf::Clock clock;
sf::Time passedTime = sf::Time::Zero;
while (window.isOpen())
{
sf::Time elapsedTime = clock.restart();
passedTime += elapsedTime;
while (passedTime > m_frameTime)
{
passedTime -= m_frameTime;
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
update(m_frameTime);
}
window.clear()
window.display();
}