Przeglądaj źródła

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 lat temu
rodzic
commit
65e039090e
1 zmienionych plików z 2 dodań i 2 usunięć
  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;
                     break;
                 }
-                else if (xPos >= area.x)
+                else if (xPos >= (int)area.x)
                 {
                     // Draw this character.
                     if (draw)
@@ -784,7 +784,7 @@ void Font::drawText(const char* text, const Rectangle& area, const Vector4& colo
                     truncated = true;
                     break;
                 }
-                else if (xPos >= area.x)
+                else if (xPos >= (int)area.x)
                 {
                     // Draw this character.
                     if (draw)