SFML community forums
Help => Graphics => Topic started by: evanbandit on December 08, 2021, 12:30:55 am
-
I have a 25px x 25px square sprite and I'm trying to set the origin to the center.
m_PlayerSprite.setOrigin(12.5, 12.5);
but! For some reason having an x value of 12.5 distorts my sprite. Any other value and it looks normal. What gives?
Attached: 1.png: normal, 2.png: distorted, player.png: base image.
EDIT: I wasn't sure how to make my attached images appear in the post. Let me know if that would help. Thanks!
-
It's advisable to always render on integer position, otherwise the rasterizer has to decide whether it draws your 0.5 pixel on the left or the right side or drops them completely. As such it's probably the easiest to pick an integer origin or set a position with 0.5 offset
-
Thank you very much!