SFML community forums
Help => Graphics => Topic started by: dabo 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:
Text.SetCenter(TextRect.GetWidth() / 2, 0.f);
Doing this fixes it:
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.
-
Is it happening only when the width is an odd number ?
-
This for example makes my text blurry:
Text.SetCenter(31.5f, 0.f);
This doesn't:
Text.SetCenter(31.f, 0.f);
-
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 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.