mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 00:26:07 +09:00
btexbin -> btxbook; baked shadow for TinyAlphNum
This commit is contained in:
@@ -1614,7 +1614,7 @@ object BTeXParser {
|
||||
|
||||
val ccDefault = TerrarumSansBitmap.toColorCode(0,0,0)
|
||||
val ccBucks = TerrarumSansBitmap.toColorCode(5,0,0)
|
||||
val ccCode = TerrarumSansBitmap.toColorCode(0,4,8)
|
||||
val ccCode = TerrarumSansBitmap.toColorCode(8,0,0)
|
||||
val ccHref = TerrarumSansBitmap.toColorCode(0,3,11)
|
||||
val ccEmph = TerrarumSansBitmap.toColorCode(0xfc11)
|
||||
val ccItemName = TerrarumSansBitmap.toColorCode(0xf03b)
|
||||
|
||||
@@ -15,7 +15,7 @@ object TinyAlphNum : BitmapFont() {
|
||||
internal const val W = 7
|
||||
internal const val H = 13
|
||||
|
||||
internal val fontSheet = TextureRegionPack("./assets/graphics/fonts/7x13_Tamzen7x14b.tga", W, H)
|
||||
internal val fontSheet = TextureRegionPack("./assets/graphics/fonts/7x13_Tamzen7x14b.tga", W+1, H+1)
|
||||
|
||||
|
||||
init {
|
||||
@@ -34,12 +34,10 @@ object TinyAlphNum : BitmapFont() {
|
||||
}
|
||||
|
||||
lateinit var colMain: Color
|
||||
lateinit var colShadow: Color
|
||||
|
||||
override fun draw(batch: Batch, text: CharSequence, x: Float, y: Float): GlyphLayout? {
|
||||
val originalColour = batch.color.cpy()
|
||||
colMain = batch.color.cpy()
|
||||
colShadow = colMain.cpy().mul(1f, 1f, 1f, 0.5f)
|
||||
|
||||
val x = x.roundToFloat()
|
||||
val y = y.roundToFloat()
|
||||
@@ -52,15 +50,8 @@ object TinyAlphNum : BitmapFont() {
|
||||
val colour = getColour(cchigh, cclow)
|
||||
|
||||
colMain = colour
|
||||
colShadow = colMain.cpy().mul(0.5f, 0.5f, 0.5f, 1f)
|
||||
}
|
||||
else if (c in 0.toChar()..255.toChar()) {
|
||||
batch.color = colShadow
|
||||
batch.draw(fontSheet.get(c.code % 16, c.code / 16), x + charsPrinted * W + 1, y)
|
||||
batch.draw(fontSheet.get(c.code % 16, c.code / 16), x + charsPrinted * W, y + 1)
|
||||
batch.draw(fontSheet.get(c.code % 16, c.code / 16), x + charsPrinted * W + 1, y + 1)
|
||||
|
||||
|
||||
batch.color = colMain
|
||||
batch.draw(fontSheet.get(c.code % 16, c.code / 16), x + charsPrinted * W, y)
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ import kotlin.system.measureTimeMillis
|
||||
*/
|
||||
class BTeXTest : ApplicationAdapter() {
|
||||
|
||||
// val filePath = "btex.xml"
|
||||
val filePath = "test.xml"
|
||||
// val filePath = "literature/en/daniel_defoe_robinson_crusoe.xml"
|
||||
val filePath = "btex.xml"
|
||||
// val filePath = "test.xml"
|
||||
// val filePath = "literature/en/daniel_defoe_robinson_crusoe.btxbook"
|
||||
// val filePath = "literature/ruRU/anton_chekhov_palata_no_6.xml"
|
||||
// val filePath = "literature/koKR/yisang_nalgae.xml"
|
||||
// val filePath = "literature/koKR/yisang_nalgae.btxbook"
|
||||
|
||||
|
||||
private lateinit var document: BTeXDocument
|
||||
@@ -54,7 +54,7 @@ class BTeXTest : ApplicationAdapter() {
|
||||
|
||||
bg = TextureRegion(Texture(Gdx.files.internal("test_assets/real_bg_with_guides.png")))
|
||||
|
||||
val isBookFinalised = filePath.endsWith(".btexbin")
|
||||
val isBookFinalised = filePath.endsWith(".btxbook")
|
||||
|
||||
if (!isBookFinalised) {
|
||||
measureTimeMillis {
|
||||
@@ -65,7 +65,7 @@ class BTeXTest : ApplicationAdapter() {
|
||||
println("Time spent on typesetting [ms]: $it")
|
||||
}
|
||||
|
||||
/*measureTimeMillis {
|
||||
measureTimeMillis {
|
||||
document.finalise()
|
||||
documentHandler.dispose()
|
||||
}.also {
|
||||
@@ -73,10 +73,10 @@ class BTeXTest : ApplicationAdapter() {
|
||||
}
|
||||
|
||||
measureTimeMillis {
|
||||
document.serialise(File("./assets/mods/basegame/books/${filePath.replace(".xml", ".btexbin")}"))
|
||||
document.serialise(File("./assets/mods/basegame/books/${filePath.replace(".xml", ".btxbook")}"))
|
||||
}.also {
|
||||
println("Time spent on serialisation [ms]: $it")
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
measureTimeMillis {
|
||||
|
||||
Reference in New Issue
Block a user