mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
some sort of error screen impl
This commit is contained in:
@@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.gameactors.floor
|
||||
|
||||
class UIItemModuleInfoCell(
|
||||
@@ -19,47 +20,49 @@ class UIItemModuleInfoCell(
|
||||
private val numberAreaWidth = Terrarum.fontSmallNumbers.W * 3 + 4
|
||||
|
||||
override fun render(batch: SpriteBatch) {
|
||||
blendNormal()
|
||||
|
||||
if (ModMgr.moduleInfo.containsKey(moduleName)) {
|
||||
val modInfo = ModMgr.moduleInfo[moduleName]!!
|
||||
|
||||
// print load order index
|
||||
batch.color = Color(0x7f7f7fff)
|
||||
batch.color = Color(0xccccccff.toInt())
|
||||
var strlen = Terrarum.fontSmallNumbers.getWidth(modInfo.order.toString())
|
||||
Terrarum.fontSmallNumbers.draw(batch,
|
||||
modInfo.order.toString(),
|
||||
(numberAreaWidth - strlen).div(2f).floor(),
|
||||
(height - Terrarum.fontSmallNumbers.H).div(2f).floor()
|
||||
posX + (numberAreaWidth - strlen).div(2f).floor(),
|
||||
posY + (height - Terrarum.fontSmallNumbers.H).div(2f).floor()
|
||||
)
|
||||
|
||||
// print module name
|
||||
batch.color = Color.WHITE
|
||||
Terrarum.fontGame.draw(batch,
|
||||
"${modInfo.properName} (${modInfo.version})",
|
||||
numberAreaWidth.toFloat(),
|
||||
0f
|
||||
posX + numberAreaWidth.toFloat(),
|
||||
posY.toFloat()
|
||||
)
|
||||
|
||||
// print author name
|
||||
strlen = Terrarum.fontGame.getWidth(modInfo.author)
|
||||
Terrarum.fontGame.draw(batch,
|
||||
modInfo.author,
|
||||
width - strlen.toFloat(),
|
||||
0f
|
||||
posX + width - strlen.toFloat(),
|
||||
posY.toFloat()
|
||||
)
|
||||
|
||||
// print description
|
||||
Terrarum.fontGame.draw(batch,
|
||||
modInfo.description,
|
||||
numberAreaWidth.toFloat(),
|
||||
Terrarum.fontGame.lineHeight
|
||||
posX + numberAreaWidth.toFloat(),
|
||||
posY + Terrarum.fontGame.lineHeight
|
||||
)
|
||||
|
||||
// print releasedate
|
||||
strlen = Terrarum.fontGame.getWidth(modInfo.releaseDate)
|
||||
Terrarum.fontGame.draw(batch,
|
||||
modInfo.releaseDate,
|
||||
width - strlen.toFloat(),
|
||||
Terrarum.fontGame.lineHeight
|
||||
posX + width - strlen.toFloat(),
|
||||
posY + Terrarum.fontGame.lineHeight
|
||||
)
|
||||
|
||||
}
|
||||
@@ -69,8 +72,8 @@ class UIItemModuleInfoCell(
|
||||
val strlen = Terrarum.fontSmallNumbers.getWidth(str)
|
||||
Terrarum.fontSmallNumbers.draw(batch,
|
||||
str,
|
||||
(width - numberAreaWidth - strlen).div(2f).floor() + numberAreaWidth,
|
||||
(height - Terrarum.fontSmallNumbers.H).div(2f).floor()
|
||||
posX + (width - numberAreaWidth - strlen).div(2f).floor() + numberAreaWidth,
|
||||
posY + (height - Terrarum.fontSmallNumbers.H).div(2f).floor()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user