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

Author Topic: Time Step understanding  (Read 1089 times)

0 Members and 1 Guest are viewing this topic.

DuffCola

  • Newbie
  • *
  • Posts: 8
    • View Profile
Time Step understanding
« on: September 14, 2013, 09:10:10 am »
Hello.
I read the sfml game development book.
I amcurrently at the time step chapter.


void run()
{
    renderWindow = new RenderWindow(sf::VideoMode(800, 600), "Test", sf::Style::Default);
    //  renderWindow.setFramerateLimit(60);             //
    //  renderWindow.setVerticalSyncEnabled(true);   //
    sf::Clock deltaTime;

    while(renderWindow.isOpen())
    {
        sf::Event events;
        while(renderWindow.pollEvent(events))
        {
            handleEvents(events);
        }
        update(deltaTime.restart());
        render(renderWindow);
    }

}

 

What going different, if I set the frame rate Limit oder/and ther cSynchr ?
Whats the best Time Step method ?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Time Step understanding
« Reply #1 on: September 14, 2013, 02:41:11 pm »
setFramerateLimit() is useful for simple cases, but it's not very accurate. setVerticalSyncEnabled() can be used in addition to our time step method, to adapt the graphic framerate to the monitor's frequency.

There is a short section about these topics on page 24.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: