Add mono spaced bmpfont sample (#33)

* Add mono spaced bmpfont sample

* Add mono spaced segment7 bmpfont
This commit is contained in:
Tobse
2020-11-07 22:16:36 +01:00
committed by GitHub
parent 486a3c917d
commit 6124dfee66
3 changed files with 34 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ import com.soywiz.korio.file.std.*
suspend fun main() = Korge(bgcolor = Colors["#333"]) {
val font1 = resourcesVfs["font1.fnt"].readBitmapFont()
val segment7 = resourcesVfs["segment7.fnt"].readBitmapFont() // mono spaced
val text1 = text("Hello World!", textSize = 96.0, font = font1)
val text2 = text("Hello World!", textSize = 96.0, font = font1) {
smoothing = false
@@ -29,4 +30,16 @@ suspend fun main() = Korge(bgcolor = Colors["#333"]) {
}
}
}
text("42:10", textSize = 64.0, font = segment7) {
val text = this
alignX(root, 0.5, true)
alignY(root, 0.75, true)
launchImmediately {
var count = 10
while (true) {
text.text = "42:${count++}"
delay(1.seconds)
}
}
}
}

View File

@@ -0,0 +1,21 @@
info face="Segment7" size=92 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=1,1,1,1 spacing=-2,-2
common lineHeight=92 base=46 scaleW=256 scaleH=256 pages=1 packed=0
page id=0 file="segment7.png"
chars count=16
char id=0 x=125 y=148 width=92 height=94 xoffset=-1 yoffset=-1 xadvance=54 page=0 chnl=0
char id=32 x=0 y=0 width=0 height=0 xoffset=-1 yoffset=73 xadvance=54 page=0 chnl=0
char id=48 x=46 y=0 width=47 height=74 xoffset=3 yoffset=1 xadvance=54 page=0 chnl=0
char id=49 x=233 y=0 width=14 height=69 xoffset=36 yoffset=3 xadvance=54 page=0 chnl=0
char id=50 x=93 y=0 width=47 height=74 xoffset=3 yoffset=1 xadvance=54 page=0 chnl=0
char id=51 x=140 y=0 width=47 height=74 xoffset=3 yoffset=1 xadvance=54 page=0 chnl=0
char id=52 x=0 y=148 width=45 height=70 xoffset=5 yoffset=2 xadvance=54 page=0 chnl=0
char id=53 x=187 y=0 width=46 height=74 xoffset=3 yoffset=1 xadvance=54 page=0 chnl=0
char id=54 x=0 y=74 width=46 height=74 xoffset=3 yoffset=1 xadvance=54 page=0 chnl=0
char id=55 x=187 y=74 width=43 height=71 xoffset=7 yoffset=1 xadvance=54 page=0 chnl=0
char id=56 x=46 y=74 width=47 height=74 xoffset=3 yoffset=1 xadvance=54 page=0 chnl=0
char id=57 x=93 y=74 width=47 height=74 xoffset=3 yoffset=1 xadvance=54 page=0 chnl=0
char id=58 x=87 y=148 width=38 height=11 xoffset=7 yoffset=31 xadvance=54 page=0 chnl=0
char id=65 x=140 y=74 width=47 height=71 xoffset=3 yoffset=1 xadvance=54 page=0 chnl=0
char id=71 x=0 y=0 width=46 height=74 xoffset=3 yoffset=1 xadvance=54 page=0 chnl=0
char id=76 x=45 y=148 width=42 height=69 xoffset=3 yoffset=6 xadvance=54 page=0 chnl=0
kernings count=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB