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

Author Topic: Scale offset  (Read 4876 times)

0 Members and 1 Guest are viewing this topic.

ThatOneGuyThatDoesStuff

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Scale offset
« on: June 22, 2021, 09:50:57 pm »
Whenever I have tried to scale a sprite, it offsets down slightly. It doesn't move left or right, but it's position is lower that it should be (greater y value). I have no idea why. Would appreciate an explanation as to what I'm doing wrong.

sprite.setScale(CATAPULT_SCALING_FRACTION);
 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Scale offset
« Reply #1 on: June 24, 2021, 12:58:23 pm »
Scaling as any other transformation happens around/from the origin.
If your origin is set to the middle of the sprite, it will expand equally in all direction.
If your origin is set to the top left corner (default), then it will scale in the bottom right direction.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

ThatOneGuyThatDoesStuff

  • Newbie
  • *
  • Posts: 28
    • View Profile
    • Email
Re: Scale offset
« Reply #2 on: June 26, 2021, 01:49:16 pm »
Scaling as any other transformation happens around/from the origin.
If your origin is set to the middle of the sprite, it will expand equally in all direction.
If your origin is set to the top left corner (default), then it will scale in the bottom right direction.

You sir, are an officer and a gentleman and a credit to your old mum and dad.