sfml download code example

Example 1: sfml basic program

#include <SFML/Window.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");

    // run the program as long as the window is open
    while (window.isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;
        while (window.pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window.close();
        }
    }

    return 0;
}

Example 2: SFML window

sf::RenderWindow window(sf::VideoMode(900,900),"My window");
//VideoMode is an object who tell to the window which size take

Tags:

Misc Example