Opening A Window

u9 not doing anything :P — Then i guess you are waiting in excitement on how to open a window ;)

Here's how to do it, and I also show you how to display a text string.

#include <SFML/Graphics.hpp>
int main()
{
    // Setup window
    sf::RenderWindow app(sf::VideoMode(800, 600, 32), "SFML String Example");
 
    // Load a font
    sf::Font font;
    font.LoadFromFile("../media/airmole.ttf");
    while (app.IsOpened())
    {
        sf::Event event;
        while (app.GetEvent(event))
        {
            // Check if user want's to exit.
            if (event.Type == sf::Event::Closed
                || (event.Type == sf::Event::KeyPressed && event.Key.Code == sf::Key::Escape))
            {
                app.Close();
            }
        }
 
        // Clear screen (Not really necessary in our case)
        app.Clear(sf::Color::Black);
 
        //Draw label
        sf::String L("Hello World", font, 30);
        L.SetPosition(400, 300);
        app.Draw(L);
 
        app.Display();
    }
 
    return 0;
}
page_revision: 2, last_edited: 1263296521|%e %b %Y, %H:%M %Z (%O ago)