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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - ronenp88

Pages: [1]
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:
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();
                }
        }
}
 

Or this is done differently ?

Pages: [1]
anything