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

Author Topic: Making scalable text or preventing views from stretching it.  (Read 5418 times)

0 Members and 1 Guest are viewing this topic.

Zaper127

  • Newbie
  • *
  • Posts: 3
    • View Profile
Making scalable text or preventing views from stretching it.
« on: September 11, 2021, 05:17:42 pm »
So now I’ve moved into my title screen text. And got it figured out. Font, message, color, and size. I can resize the window if it’s in the main view and the text doesn’t change size but moves and stays sharp, and getGlobalBoundingbox() works perfectly regardless of the move. But when I put it inside any view that is not exactly the size of the window, even with the size set to the size of the text or larger, it becomes horribly blurry and the bounding box is moved to the top left of the window, even if outside the view, and becomes like 1X1 pixel big. So my question is how do I stop this? Text that scales with the view yet stays crips is Ideal, but even if I can stop the view from distorting it and destroying the bounding box I could work with it. I will need the views for positioning, scrolling threw longer lists, and so one later so I have to have a solution to put it in a view.

Does anyone have a link to to a good tutorial or know the answer for this? Thank you.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11033
    • View Profile
    • development blog
    • Email
Re: Making scalable text or preventing views from stretching it.
« Reply #1 on: September 27, 2021, 08:39:13 am »
You can't really. Text is rendered like a texture, if the view is scale, so is the "texture" of the text.
Instead you'll always have to use your own view that doesn't scale with the game view and then adjust the font size, if you need bigger or smaller text.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything