Explorar el Código

fixed TextBox caret image aspect ratio

Andrew Karpushin hace 12 años
padre
commit
1adf673c1c
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      gameplay/src/TextBox.cpp

+ 2 - 1
gameplay/src/TextBox.cpp

@@ -397,7 +397,8 @@ void TextBox::drawImages(SpriteBatch* spriteBatch, const Rectangle& clip)
             Vector4 color = _caretImage->getColor();
             color.w *= _opacity;
 
-            spriteBatch->draw(_caretLocation.x - (region.width / 2.0f), _caretLocation.y, region.width, _fontSize, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color, _viewportClipBounds);
+            float caretWidth = region.width * _fontSize / region.height;
+            spriteBatch->draw(_caretLocation.x - caretWidth * 0.5f, _caretLocation.y, caretWidth, _fontSize, uvs.u1, uvs.v1, uvs.u2, uvs.v2, color, _viewportClipBounds);
         }
     }