0
\$\begingroup\$

Usually i set up timestep something like this:

timestep=1.0f/60.0f;
if(time>=timestep)
{
update;
time-=timestep;
}

But SFML has the next function: window.setFramerateLimit(). Does it do the same thing i described above?

\$\endgroup\$
2
\$\begingroup\$

The function in question doesn't account for the actual frame rate being achieved. It just stalls the program to ensure a certain frame rate isn't surpassed.

For example, if you set the limit to 60, your program updates and draws at a constant maximum speed of 60Hz, but it's also possible everything sled down more while under heavy load.

In most cases you'd still want to implement your game update the way you suggested.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.