This was taken from the sample given by the documentation on the main page. The comments explain the situation.
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
int main()
{
//if you uncomment this code, the sprite will appear white.
/*sf::Texture texture;
if (!texture.loadFromFile("battlemage.gif"))
return EXIT_FAILURE;
sf::Sprite sprite(texture);
*/
// Create the main window
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
// Load a sprite to display
//if you uncomment this code, the sprite will appear normally.
/*sf::Texture texture;
if (!texture.loadFromFile("battlemage.gif"))
return EXIT_FAILURE;
sf::Sprite sprite(texture);*/
// Start the game loop
while (window.isOpen())
{
// Process events
sf::Event event;
while (window.pollEvent(event))
{
// Close window : exit
if (event.type == sf::Event::Closed)
window.close();
}
// Clear screen
window.clear();
// Draw the sprite
window.draw(sprite);
// Update the window
window.display();
}
return EXIT_SUCCESS;
}
Thanks for writing this library. If find it much easier to use then SDL, and it is much more intuitive.