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.


Messages - Yanson

Pages: [1]
1
I don't think the windows title is meant to be updated this much.

#include <SFML/Graphics.hpp>
#include <string>
#include <iostream>

int main()
{
    sf::RenderWindow window(sf::VideoMode(640, 480), "Test");
    sf::Clock clock;
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
        }
        float fps = 1.0f / clock.getElapsedTime().asSeconds();
        window.setTitle("FPS: " + std::to_string(fps));
        sf::sleep(sf::seconds(1));
        window.clear();
        window.display();
    }
    return 0;
}

Pages: [1]