Browse Source

Fix text rendering on non-integer x position.

Rendering at non-integer x position makes first character of every line
disappear. It is because the position gets rounded down to integer and later
compared against the original float. First character then seem to be out of
the text area.
Michal Srb 11 years ago
parent
commit
65e039090e
1 changed files with 2 additions and 2 deletions
  1. 2 2
      gameplay/src/Font.cpp

+ 2 - 2
gameplay/src/Font.cpp

@@ -351,7 +351,7 @@ Font::Text* Font::createText(const char* text, const Rectangle& area, const Vect
                     truncated = true;
                     truncated = true;
                     break;
                     break;
                 }
                 }
-                else if (xPos >= area.x)
+                else if (xPos >= (int)area.x)
                 {
                 {
                     // Draw this character.
                     // Draw this character.
                     if (draw)
                     if (draw)
@@ -784,7 +784,7 @@ void Font::drawText(const char* text, const Rectangle& area, const Vector4& colo
                     truncated = true;
                     truncated = true;
                     break;
                     break;
                 }
                 }
-                else if (xPos >= area.x)
+                else if (xPos >= (int)area.x)
                 {
                 {
                     // Draw this character.
                     // Draw this character.
                     if (draw)
                     if (draw)