SFML community forums
Help => Graphics => Topic started by: N1ghtly on January 08, 2012, 08:05:15 pm
-
Hello all,
I'm trying to get sfml up and running on linux. I downloaded the latest Git snapshot and compiled. I link correctly to the libs, yet I keep getting the error stated in the title.
Any suggestions?
-
You are probably calling Sprite.GetSize() somewhere, but this function doesn't exist.
You probably found the function in the sfml 1.6 tutorial, but it seems to be removed in sfml2.
After a quick look in Sprite.hpp I think you will need GetTextureRect.
This function is a little bit different (it returns a rect instead of the size), but I think it will give you the same result.
Otherwise you can call Texture.GetWidth() and Texture.GetHeight() to find out what the size of the texture is.
-
TextureRect doesn't take the scale in account. The correct replacement is sprite.GetGlobalBounds(), which returns the bounding rectangle. You can then extract its width/height.
-
Thanks, I wasn't aware these functions had been removed. I used an older version of SFML 2 before this.