SFML community forums

Help => Window => Topic started by: Nexus on January 21, 2012, 10:58:24 am

Title: Removed sf::Window::GetFrameTime()?
Post by: Nexus on January 21, 2012, 10:58:24 am
What has happened to GetFrameTime()? Do you prefer it time is measured on user side? It looks like sf::Window already uses a clock for SetFramerateLimit(), doesn't it?
Title: Removed sf::Window::GetFrameTime()?
Post by: Laurent on January 21, 2012, 11:35:34 am
It was removed because it was not as good as a user-side clock.

It was mainly used to get the elapsed time to pass to update functions, but:
- the returned time was wrong (last frame duration instead of time elapsed since last update)
- there's no reason for such a function to be in the sf::Window class

The new way of measuring the update time is 100% accurate (also thanks to the new sf::Clock::Restart function):
Code: [Select]
sf::Clock clock;
...
Update(clock.Restart());


The other use of this function was to compute FPS, but I don't consider that it deserves a dedicated function in the public API.
Title: Removed sf::Window::GetFrameTime()?
Post by: Nexus on January 21, 2012, 12:02:11 pm
Okay, then I am going to use sf::Clock directly in the future. Thanks for the explanation!