1
Window / Window Not Opening
« on: January 26, 2012, 02:05:02 am »
Hello, I'm not sure what's wrong with this code because no window is opening up for me. xD
I'm also trying to open this up as a GUI application in SFML 1.6 & Code Blocks 10.05 if that helps.
I'm also trying to open this up as a GUI application in SFML 1.6 & Code Blocks 10.05 if that helps.
Quote
int main()
{
// Create the main rendering window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Window");
sf::Image SceneImage;
if (!SceneImage.LoadFromFile("Image.png"))
{
return EXIT_FAILURE;
}
sf::Sprite Scene(SceneImage);
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if ((Event.Type == sf::Event::Closed) ||
((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)))
{
App.Close();
break;
}
}
// Clear the screen (fill it with black color)
App.Clear();
App.Draw(Scene);
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}