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

Author Topic: SetCenter() blurs my text sometimes  (Read 2843 times)

0 Members and 1 Guest are viewing this topic.

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
SetCenter() blurs my text sometimes
« on: May 26, 2008, 09:11:01 pm »
Is this just happening to me? When I give the method mentioned in the subject "float" parameters sometimes the text gets blurry. For example:

Code: [Select]
Text.SetCenter(TextRect.GetWidth() / 2, 0.f);

Doing this fixes it:

Code: [Select]
Text.SetCenter((int) TextRect.GetWidth() / 2, 0.f);

I find it strange that this method takes "float" parameters if I must use (int) conversion in order to make sure I don't get blurry text.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SetCenter() blurs my text sometimes
« Reply #1 on: May 27, 2008, 06:09:50 pm »
Is it happening only when the width is an odd number ?
Laurent Gomila - SFML developer

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
SetCenter() blurs my text sometimes
« Reply #2 on: May 28, 2008, 12:15:04 pm »
This for example makes my text blurry:

Code: [Select]
Text.SetCenter(31.5f, 0.f);

This doesn't:

Code: [Select]
Text.SetCenter(31.f, 0.f);

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SetCenter() blurs my text sometimes
« Reply #3 on: May 28, 2008, 02:58:49 pm »
Ok I see. I guess it's related to the way half-pixels are rasterized, and in this case we can't help much. The easiest solution for you is to use integer coordinates.

If you wonder why SFML uses float coordinates, it's because those coordinates are not pixels, they are view units. So you could have a view covering the entire window but which is only 1 unit long ;)
Laurent Gomila - SFML developer

dabo

  • Sr. Member
  • ****
  • Posts: 260
    • View Profile
    • http://www.dabostudios.net
SetCenter() blurs my text sometimes
« Reply #4 on: May 28, 2008, 05:51:26 pm »
Quote from: "Laurent"
Ok I see. I guess it's related to the way half-pixels are rasterized, and in this case we can't help much. The easiest solution for you is to use integer coordinates.

If you wonder why SFML uses float coordinates, it's because those coordinates are not pixels, they are view units. So you could have a view covering the entire window but which is only 1 unit long ;)


Ok, thanks. It's not a big problem for me, I'm fine using the int conversion.