always draw at integer position

This commit is contained in:
minjaesong
2017-10-21 04:10:01 +09:00
parent 08d54e13c0
commit 279ca757d9
3 changed files with 243 additions and 133 deletions

View File

@@ -400,6 +400,11 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
private lateinit var originalColour: Color
override fun draw(batch: Batch, str: CharSequence, x: Float, y: Float): GlyphLayout? {
// always draw at integer position; this is bitmap font after all
val x = Math.round(x).toFloat()
val y = Math.round(y).toFloat()
if (textBuffer != str) {
textBuffer = str
val widths = getWidthOfCharSeq(str)

View File

@@ -419,6 +419,11 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
}
override fun drawString(x: Float, y: Float, str: String, color: Color) {
// always draw at integer position; this is bitmap font after all
val x = Math.round(x).toFloat()
val y = Math.round(y).toFloat()
if (textBuffer != str) {
textBuffer = str
val widths = getWidthOfCharSeq(str)