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

Author Topic: Text gets blurry when resizing window.  (Read 2433 times)

0 Members and 1 Guest are viewing this topic.

Xrey274

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Text gets blurry when resizing window.
« on: March 09, 2019, 06:19:57 pm »
Whenever I resize the window the text gets blurred. I even made a "text update" function, but that doesn't seem to matter.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Text gets blurry when resizing window.
« Reply #1 on: March 09, 2019, 06:25:20 pm »
Yes, that's because everything gets scaled. You can adjust the view to the new size of the window if you don't want this to happen.
Laurent Gomila - SFML developer

Xrey274

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Text gets blurry when resizing window.
« Reply #2 on: March 10, 2019, 11:18:46 pm »
I did this but still blurry, even after updating the text manually.

window.setView(sf::View(sf::FloatRect(0, 0, event.size.width, event.size.height)));

    width = windowWidth;
    height = windowHeight;

    changeBrushText.setString("Change Brush");
    changeBrushText.setFont(font);
    changeBrushText.setCharacterSize(width / 96);
    changeBrushText.setFillColor(sf::Color(210, 210, 210));
    changeBrushText.setPosition(((width / 10) - changeBrushText.getLocalBounds().width) / 2,((height / 27  ) - changeBrushText.getLocalBounds().height) / 2);


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Text gets blurry when resizing window.
« Reply #3 on: March 11, 2019, 07:59:56 am »
Round the coordinates that you pass to setPosition. See here for more details.
Laurent Gomila - SFML developer

Xrey274

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
Re: Text gets blurry when resizing window.
« Reply #4 on: March 11, 2019, 06:17:55 pm »
That was it - thanks! Why does the function .setPosition() even take in floats?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Text gets blurry when resizing window.
« Reply #5 on: March 11, 2019, 06:36:12 pm »
You should know why, if you read the link I posted ;)
Laurent Gomila - SFML developer

 

anything