SFML community forums
Help => Graphics => Topic started by: freetheworld on April 26, 2017, 08:21:17 pm
-
I don't know; if this has ever been brought up, It's happened like this for me ever since I started using sfml back around 1.4, if it's a bug, or I'm just doing it wrong.
I use the sprite.setScale() to set the size of my sprites no matter what the size of the incoming texture is, but for some reason it doesnt work if the texture is smaller than 32x32
float width = 64;
float height = 64;
sprite.setScale(width / sprite.getLocalBounds().width, height / sprite.getLocalBounds().height);
Funny part is, say I know my texture is 16x16 so I plug the numbers in without using getLocalBounds(), it works fine. ie...
sprite.setScale(width / 16, height / 16);
does exactly what I would expect.
-
I'm having a hard time trying to find a description of what is actually happening and what is going wrong in your post. It might be there but I'm failing to discover it, sorry.
-
IMHO it looks like sprite.getLocalBounds().width and sprite.getLocalBounds().height somehow have wrong values, could you print them out and post here?
-
Make sure you're calling getLocalBounds after you've set the texture and texture rect.