SFML community forums
Help => Graphics => Topic started by: JM1082 on March 21, 2012, 02:33:41 pm
-
Hi all,
I want to use the Sprite.GetSize() function on a sprite I've loaded into my RenderWindow.
My sprite is called buttonTwo, so when I try to:
cout << buttonTwo.GetSize() << endl;
OR
simply calling buttonTwo.GetSize() on its own...
I'm expecting something alond the lines of pixel ranges, i.e. 1024, 600...
Instead I get a bunch of warnings talking about a Vector2f...
So I tried creating a float variable, capturing the function output into it, then displaying it:
float size = buttonTwo.GetSize();
cout << size << endl;
But still no luck...
Any suggestions would be much appreciated.
-
you using 2.0? Because getSize does't exist.
In 1.6 GetSize() returns a Vector2f. A Vector2f has an x and y, so you'll need to use
buttonTwo.GetSize().x or buttonTwo.GetSize().y
-
Thanks! That's a great help!!! ^^