1
General / How to Clock framing the game
« on: April 30, 2020, 08:51:11 am »
Hopefully this is the right place to ask,
I'm wondering if this is the proper way of doing this clock framing:
Or this is done differently ?
I'm wondering if this is the proper way of doing this clock framing:
void game::run() {
sf::Clock clock;
sf::Time frameTime = sf::milliseconds(10);
while (window.isOpen()) {
sf::Time elapsed = clock.getElapsedTime();
if (elapsed > frameTime) {
logic();
draw();
clock.restart();
}
}
}
sf::Clock clock;
sf::Time frameTime = sf::milliseconds(10);
while (window.isOpen()) {
sf::Time elapsed = clock.getElapsedTime();
if (elapsed > frameTime) {
logic();
draw();
clock.restart();
}
}
}
Or this is done differently ?