SFML community forums

Help => Graphics => Topic started by: Trollger on November 01, 2010, 04:00:22 am

Title: get the width in pixels of a sf::drawable object
Post by: Trollger 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
Title: get the width in pixels of a sf::drawable object
Post by: Relic 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.
Title: get the width in pixels of a sf::drawable object
Post by: Trollger 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.