mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
new watch design consistent with existing UI
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package net.torvald.terrarum.modulebasegame.imagefont
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.Batch
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont
|
||||
import com.badlogic.gdx.graphics.g2d.GlyphLayout
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2019-01-24.
|
||||
*/
|
||||
object WatchFont : BitmapFont() {
|
||||
internal val W = 9
|
||||
internal val H = 12
|
||||
|
||||
internal val fontSheet = TextureRegionPack(ModMgr.getGdxFile("basegame", "fonts/watch_new.tga"), W, H)
|
||||
|
||||
init {
|
||||
setOwnsTexture(true)
|
||||
}
|
||||
|
||||
override fun draw(batch: Batch, str: CharSequence, x: Float, y: Float): GlyphLayout? {
|
||||
|
||||
str.forEachIndexed { index, c ->
|
||||
batch.draw(
|
||||
fontSheet.get((c - '0') % 16, (c - '0') / 16),
|
||||
x + W * index, y
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getLineHeight() = H.toFloat()
|
||||
override fun getCapHeight() = getLineHeight()
|
||||
override fun getXHeight() = getLineHeight()
|
||||
}
|
||||
Reference in New Issue
Block a user