This is how I am doing it now, a fixed timestep for the physics:
sf::Clock deltaClock;
sf::Time deltaTime;
sf::Time timePerFrame = sf::seconds(1.f / 60.f);
sf::Time timeSinceLastUpdate = sf::Time::Zero;
while (window_->isOpen()) {
deltaTime = deltaClock.restart();
timeSinceLastUpdate += deltaTime;
while (timeSinceLastUpdate > timePerFrame) {
timeSinceLastUpdate -= timePerFrame;
game_.processEvents();
game_.update(timePerFrame);
}
game_.render();
}
It's looking good to me and dragging the window around and whatnot all works well.
Now, that's the correct way to do it, right?