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

Author Topic: [Solved]Distorted text due to resizing  (Read 3534 times)

0 Members and 2 Guests are viewing this topic.

FolliotJunior

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
[Solved]Distorted text due to resizing
« on: May 20, 2021, 10:23:23 am »
Hi all, I'm currently discovering the module, and I have a problem: when I display a Sprite or a text with the draw() method, they are then distorted when I distort the window, but I would like them to keep their size scales. Thanks in advance for your help.
« Last Edit: May 20, 2021, 10:43:25 am by FolliotJunior »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Distorted text due to resizing
« Reply #1 on: May 20, 2021, 10:32:25 am »
When changing the window, the view is not automatically adjusted, thus anything drawn, will be stretched accordingly.

You need to adjust the view after the window was resized.
If you only want the text to be rendered correctly, but the rest should still be stretched, then you'll need to use a second view that is adjusted, while keeping the default view for everything else.

See also the tutorial on views: https://www.sfml-dev.org/tutorials/2.5/graphics-view.php#showing-more-when-the-window-is-resized
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

FolliotJunior

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Distorted text due to resizing
« Reply #2 on: May 20, 2021, 10:43:05 am »
Thank you very much, I didn't see this page, so it is solved

 

anything