SFML community forums

Help => General => Topic started by: WedranB on December 24, 2011, 03:37:09 pm

Title: SFML no grapics window
Post by: WedranB on December 24, 2011, 03:37:09 pm
Here is my problem.When i try to run this code i only get CMD window and no SFML window(800x600)...Where is the problem?

http://imageshack.us/photo/my-images/715/21742770.png/

Code: [Select]

#include <SFML/Graphics.hpp>


int main()
{
    // Create the main rendering window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");

    // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // A key has been pressed
            if (Event.Type == sf::Event::KeyPressed)
            {
                // Escape key : exit
                if (Event.Key.Code == sf::Key::Escape)
                    App.Close();

                // F1 key : capture a screenshot
                if (Event.Key.Code == sf::Key::F1)
                {
                    sf::Image Screen = App.Capture();
                    Screen.SaveToFile("screenshot.jpg");
                }
            }
        }

        // Clear the screen with red color
        App.Clear(sf::Color(200, 0, 0));

        // Display window contents on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


Title: SFML no grapics window
Post by: Pyrius on December 24, 2011, 04:36:23 pm
It works just fine for me (SFML2).
Title: SFML no grapics window
Post by: c0ffee on December 28, 2011, 03:37:34 pm
it also works with 1.6
Title: SFML no grapics window
Post by: The DarK' on December 28, 2011, 03:47:32 pm
Do you have an ATI graphic card ?

It could cause issue with SFML 1.6 (which is not maintened anymore). You can use 2.0.