1
Graphics / Bug in scalling up small sprites... or am I doing it wrong
« 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 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.