Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Set size of the sprtite  (Read 1097 times)

0 Members and 1 Guest are viewing this topic.

hakeris1010

  • Newbie
  • *
  • Posts: 7
    • View Profile
Set size of the sprtite
« 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???

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Set size of the sprtite
« Reply #1 on: September 08, 2014, 04:56:44 pm »
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))