no more context fuckups on apploader

This commit is contained in:
minjaesong
2019-07-02 04:57:43 +09:00
parent eb4bdbacde
commit 4c23cde4a9
81 changed files with 635 additions and 563 deletions

View File

@@ -3,8 +3,8 @@ package net.torvald.terrarum.ui
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.ModMgr
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.blendNormal
import net.torvald.terrarum.floor
@@ -20,9 +20,9 @@ class UIItemModuleInfoCell(
override var oldPosX = posX
override var oldPosY = posY
override val height: Int = Terrarum.fontGame.lineHeight.toInt() * 2
override val height: Int = AppLoader.fontGame.lineHeight.toInt() * 2
private val numberAreaWidth = Terrarum.fontSmallNumbers.W * 3 + 4
private val numberAreaWidth = AppLoader.fontSmallNumbers.W * 3 + 4
override fun render(batch: SpriteBatch, camera: Camera) {
blendNormal(batch)
@@ -32,53 +32,53 @@ class UIItemModuleInfoCell(
// print load order index
batch.color = Color(0xccccccff.toInt())
var strlen = Terrarum.fontSmallNumbers.getWidth(modInfo.order.toString())
Terrarum.fontSmallNumbers.draw(batch,
var strlen = AppLoader.fontSmallNumbers.getWidth(modInfo.order.toString())
AppLoader.fontSmallNumbers.draw(batch,
modInfo.order.toString(),
posX + (numberAreaWidth - strlen).div(2f).floor(),
posY + (height - Terrarum.fontSmallNumbers.H).div(2f).floor()
posY + (height - AppLoader.fontSmallNumbers.H).div(2f).floor()
)
// print module name
batch.color = Color.WHITE
Terrarum.fontGame.draw(batch,
AppLoader.fontGame.draw(batch,
"${modInfo.properName} (${modInfo.version})",
posX + numberAreaWidth.toFloat(),
posY.toFloat()
)
// print author name
strlen = Terrarum.fontGame.getWidth(modInfo.author)
Terrarum.fontGame.draw(batch,
strlen = AppLoader.fontGame.getWidth(modInfo.author)
AppLoader.fontGame.draw(batch,
modInfo.author,
posX + width - strlen.toFloat(),
posY.toFloat()
)
// print description
Terrarum.fontGame.draw(batch,
AppLoader.fontGame.draw(batch,
modInfo.description,
posX + numberAreaWidth.toFloat(),
posY + Terrarum.fontGame.lineHeight
posY + AppLoader.fontGame.lineHeight
)
// print releasedate
strlen = Terrarum.fontGame.getWidth(modInfo.releaseDate)
Terrarum.fontGame.draw(batch,
strlen = AppLoader.fontGame.getWidth(modInfo.releaseDate)
AppLoader.fontGame.draw(batch,
modInfo.releaseDate,
posX + width - strlen.toFloat(),
posY + Terrarum.fontGame.lineHeight
posY + AppLoader.fontGame.lineHeight
)
}
else {
batch.color = Color(0xff8080_ff.toInt())
val str = "InternalError: no such module: '$moduleName'"
val strlen = Terrarum.fontSmallNumbers.getWidth(str)
Terrarum.fontSmallNumbers.draw(batch,
val strlen = AppLoader.fontSmallNumbers.getWidth(str)
AppLoader.fontSmallNumbers.draw(batch,
str,
posX + (width - numberAreaWidth - strlen).div(2f).floor() + numberAreaWidth,
posY + (height - Terrarum.fontSmallNumbers.H).div(2f).floor()
posY + (height - AppLoader.fontSmallNumbers.H).div(2f).floor()
)
}
}