SFML community forums

Help => Graphics => Topic started by: Linux Vs God on August 14, 2011, 09:29:19 am

Title: SFML 2.0 Visual Studio sf::Sprite
Post 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
Title: SFML 2.0 Visual Studio sf::Sprite
Post by: Laurent on August 14, 2011, 09:39:32 am
Quote
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
Title: SFML 2.0 Visual Studio sf::Sprite
Post by: Linux Vs God on August 14, 2011, 09:58:16 am
So how would I set a sprites image? I read through the documentation and I still don't understand.
Title: SFML 2.0 Visual Studio sf::Sprite
Post by: Laurent on August 14, 2011, 10:05:21 am
Seriously? ...

Quote from: "documentation example"
Code: [Select]
// 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
Title: SFML 2.0 Visual Studio sf::Sprite
Post by: Linux Vs God on August 14, 2011, 10:06:48 am
thank you.