[ create a new paste ] login | about

Link: http://codepad.org/cyjmnPqH    [ raw code | fork ]

C++, pasted on Mar 23:
#include <SFML/Graphics.hpp>
#include <sstream>

using namespace sf;
using namespace std;

int main()
{
    RenderWindow app(VideoMode(800, 600, 32), "SFML Test");
    app.setVerticalSyncEnabled(true);
    app.create(VideoMode(800, 600, 32), "SFML Test");
    Clock myClock;
    float fps = 1 / myClock.restart().asSeconds();
    stringstream ssFPS;
    ssFPS << "fps: " << fps;
    Text myText(ssFPS.str());

    while (app.isOpen()){
        Event evento;
        while (app.pollEvent(evento)){
            if (evento.type == Event::Closed){
                app.close();
            }
        }

        fps = 1 / myClock.restart().asSeconds();
        stringstream ssFPS;
        ssFPS << "fps: " << fps;
        Text myText(ssFPS.str());

        app.clear();
        app.draw(myText);
        app.display();
    }

    return 0;
}


Create a new paste based on this one


Comments: