mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-10 21:31:50 +09:00
always draw at integer position
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user