SFML community forums
Help => Graphics => Topic started by: barnack on May 13, 2019, 06:42:15 pm
-
Hi,
is there any way to force the size of a sprite to be rounded after scaling? I didn't find anything except a "setSize" that existed in previous SFML versions...
-
It's very strange that this function doesn't exist indeed.
The workaround is to use sf::RectangleShape, I guess.
I wonder why it was removed.
-
Because setSize is really just setScale(size / textureRect.size).
-
Yeah, but you can get a ton of rounding errors because of division/multiplication.
-
If so, setSize did not solve anything ;)
-
Ah, I remembered how Transformable stores scale and later computes transform matrix.
Yeah, in this case getting rounding errors is inevitable.
OP should probably use RectangleShape for precise integer sprite sizes, yeah.