SFML community forums

Help => Graphics => Topic started by: Putarda on September 10, 2016, 11:38:23 pm

Title: How to get size of the scaled sprite texture
Post by: Putarda on September 10, 2016, 11:38:23 pm
As title says how can i get size of the scaled sprite texture?
Title: Re: How to get size of the scaled sprite texture
Post by: Putarda on September 11, 2016, 10:26:08 am
Fixed by calling sprite.getGlobalBounds()
Title: Re: How to get size of the scaled sprite texture
Post by: Hapax on September 12, 2016, 03:02:08 pm
Note that getGlobalBounds will most likely not give you the desired result if the sprite is rotated.

You can, though, use something like this:
const sf::Vector2f spriteSize(
    sprite.getTexture()->getSize().x * sprite.getScale().x,
    sprite.getTexture()->getSize().y * sprite.getScale().y);