Skip to content

Instantly share code, notes, and snippets.

@ngscheurich
Created July 14, 2012 20:34
Show Gist options
  • Save ngscheurich/3113245 to your computer and use it in GitHub Desktop.
Save ngscheurich/3113245 to your computer and use it in GitHub Desktop.
Display a 2D graphic using SFML
// @library SFML 2.0 RC
// Load the texture for the sprite
sf::Texture texture;
if (!texture.loadFromFile("file.png")) {
return EXIT_FAILURE;
}
// Make drawable sprite using texture
sf::Sprite sprite(texture);
while (window.isOpen()) {
window.clear();
// Draw sprite
window.draw(sprite);
window.display();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment