SFML community forums
Help => Graphics => Topic started by: hakeris1010 on September 08, 2014, 04:48:10 pm
-
Hello! I need to set the the specific size of the sprite. SetScale() is not a solution there, because sprite may come in unknown dimensions, and program must resize it to lets say 160x100. What to do???
-
scaleX is wantedX / currentX
scaleY is wantedY / currentY
If you don't care about the size ratio of your sprite, just setScale(scaleX, scaleY)
If you want it to keep the same ratio, use the minimum scale for x and y, setScale(min(scaleX, scaleY), min(scaleX, scaleY))