Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Removed sf::Window::GetFrameTime()?  (Read 13918 times)

0 Members and 1 Guest are viewing this topic.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Removed sf::Window::GetFrameTime()?
« 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?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Removed sf::Window::GetFrameTime()?
« Reply #1 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.
Laurent Gomila - SFML developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Removed sf::Window::GetFrameTime()?
« Reply #2 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!
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: