Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Sprite.GetSize() advice needed...  (Read 1750 times)

0 Members and 1 Guest are viewing this topic.

JM1082

  • Newbie
  • *
  • Posts: 4
    • View Profile
Sprite.GetSize() advice needed...
« 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:

Code: [Select]
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:

Code: [Select]
float size = buttonTwo.GetSize();
cout << size << endl;


But still no luck...

Any suggestions would be much appreciated.

dotty

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Sprite.GetSize() advice needed...
« Reply #1 on: March 21, 2012, 02:43:10 pm »
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

JM1082

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Sprite.GetSize() advice needed...
« Reply #2 on: March 29, 2012, 06:49:56 pm »
Thanks!  That's a great help!!!  ^^