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

Author Topic: get the width in pixels of a sf::drawable object  (Read 1889 times)

0 Members and 1 Guest are viewing this topic.

Trollger

  • Newbie
  • *
  • Posts: 5
    • View Profile
get the width in pixels of a sf::drawable object
« on: November 01, 2010, 04:00:22 am »
Hi every one

I know this is probably a silly question but I can't seem to manage to figure out how to get the width in pixels of a sf::drawable object.

If I use GetScale() then I just get 1, I know why that is but I need to get the objects width in pixels.

Any help to this possibly silly question is appreciated.  :D

Relic

  • Newbie
  • *
  • Posts: 43
    • View Profile
get the width in pixels of a sf::drawable object
« Reply #1 on: November 01, 2010, 06:45:04 am »
The abstract class sf::Drawable has no methods to get the object size. If you use its descendants (sprite, text) they have appropriate methods (GetSize(), GetRect()). If you write your own descendant class of sf::Drawable, you should provide its specific methods.

Trollger

  • Newbie
  • *
  • Posts: 5
    • View Profile
get the width in pixels of a sf::drawable object
« Reply #2 on: November 01, 2010, 03:28:58 pm »
OK thanks I was using sf::shape for my application but I guess I will have to use sf::sprite instead.

 

anything