Hello everyone,
I'm trying to make this simple program work. It is giving me no errors at all. However, when I run it it just displays a command prompt. No SFML screen or something like that, just a command prompt with no text in it. Why isn't is displaying a nice sprite like I want it to?
My code:
#include "stdafx.h"
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
int main()
{
// Create the main window
sf::RenderWindow App(sf::VideoMode(800, 600, 32), "SFML Graphics");
sf::Image Image;
if (!Image.LoadFromFile("sprite.png"))
{
// dat error
}
sf::Sprite Sprite(Image);
Sprite.SetPosition(200.f, 100.f);
Sprite.SetScale(2.f, 2.f);
// Start main loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Clear screen
App.Clear();
// Display sprite in the window
App.Draw(Sprite);
// Display window contents on screen
App.Display();
}
return EXIT_SUCCESS;
}
I'm on Windows 7 using Visual C++ 2008 Express. Thanks in advance.