SFML community forums
Help => Graphics => Topic started by: Linux Vs God on August 14, 2011, 09:29:19 am
-
I compiled sfml 2.0 with nmake using this tutorial http://www.youtube.com/watch?v=PtSDrLpV74M&feature=iv&annotation_id=annotation_175195. Everything is fine and dandy until I want to work with sprites. My error "Error: class "sf::Sprite" has no member "SetImage"". On my old computer a few weeks ago I compiled sfml 2.0 the same way i just did and it worked. Now it doesn't. Was there a change in sfml? Please help
-
Now it doesn't. Was there a change in sfml?
Yes. Please read the online documentation, and the relevant topics in the general forum.
http://www.sfml-dev.org/forum/viewtopic.php?t=5343
http://www.sfml-dev.org/forum/viewtopic.php?t=5503
-
So how would I set a sprites image? I read through the documentation and I still don't understand.
-
Seriously? ...
// Declare and load a texture
sf::Texture texture;
texture.LoadFromFile("texture.png");
// Create a sprite
sf::Sprite sprite;
sprite.SetTexture(texture);
sprite.SetSubRect(sf::IntRect(10, 10, 50, 30));
sprite.Resize(100, 60);
// Display it
window.Draw(sprite); // window is a sf::RenderWindow
-
thank you.