mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 20:14:05 +09:00
no more context fuckups on apploader
This commit is contained in:
@@ -10,8 +10,8 @@ import net.torvald.terrarum.Terrarum.mouseTileY
|
||||
import net.torvald.terrarum.controller.TerrarumController
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.imagefont.TinyAlphNum
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.GameWorldExtension
|
||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory
|
||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas
|
||||
@@ -40,7 +40,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
private val world: GameWorld?
|
||||
get() = Terrarum.ingame?.world
|
||||
private val world2: GameWorldExtension?
|
||||
get() = Terrarum.ingame?.world as GameWorldExtension?
|
||||
get() = Terrarum.ingame?.world as? GameWorldExtension?
|
||||
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
@@ -179,8 +179,8 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
//printLineColumn(batch, 2, 2, "Env colour temp $ccG" + FeaturesDrawer.colTemp)
|
||||
|
||||
if (world != null) {
|
||||
printLineColumn(batch, 2, 5, "Time $ccG${world2!!.worldTime.todaySeconds.toString().padStart(5, '0')}" +
|
||||
" (${world2!!.worldTime.getFormattedTime()})")
|
||||
printLineColumn(batch, 2, 5, "Time $ccG${world2?.worldTime?.todaySeconds.toString().padStart(5, '0')}" +
|
||||
" (${world2?.worldTime?.getFormattedTime()})")
|
||||
}
|
||||
|
||||
if (player != null) {
|
||||
@@ -189,14 +189,14 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
printLineColumn(batch, 2, 7, "noClip $ccG${player.isNoClip}")
|
||||
}
|
||||
|
||||
drawHistogram(batch, LightmapRenderer.histogram,
|
||||
/*drawHistogram(batch, LightmapRenderer.histogram,
|
||||
Terrarum.WIDTH - histogramW - TinyAlphNum.W * 2,
|
||||
Terrarum.HEIGHT - histogramH - TinyAlphNum.H * 4
|
||||
)
|
||||
)*/ // histogram building is currently bugged
|
||||
|
||||
batch.color = Color.WHITE
|
||||
|
||||
val gamepad = (Terrarum.ingame as? Ingame)?.ingameController?.gamepad
|
||||
val gamepad = (Terrarum.ingame as? TerrarumIngame)?.ingameController?.gamepad
|
||||
if (gamepad != null) {
|
||||
drawGamepadAxis(gamepad, batch,
|
||||
gamepad.getAxis(AppLoader.getConfigInt("gamepadaxislx")),
|
||||
@@ -211,20 +211,20 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
*/
|
||||
|
||||
// memory pressure
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}MEM ", (Terrarum.WIDTH - 23 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}MEM ", (Terrarum.WIDTH - 23 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
// thread count
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}CPUs${if (Terrarum.MULTITHREAD) ccG else ccR}${Terrarum.THREADS.toString().padStart(2, ' ')}",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}CPUs${if (AppLoader.MULTITHREAD) ccG else ccR}${AppLoader.THREADS.toString().padStart(2, ' ')}",
|
||||
(Terrarum.WIDTH - 2 - 8 * TinyAlphNum.W).toFloat(), line(2))
|
||||
|
||||
// memory texts
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${Terrarum.memJavaHeap}M",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${Terrarum.memJavaHeap}M",
|
||||
(Terrarum.WIDTH - 19 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
Terrarum.fontSmallNumbers.draw(batch, "/${Terrarum.memNativeHeap}M/",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "/${Terrarum.memNativeHeap}M/",
|
||||
(Terrarum.WIDTH - 14 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${Terrarum.memXmx}M",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${Terrarum.memXmx}M",
|
||||
(Terrarum.WIDTH - 7 * TinyAlphNum.W - 2).toFloat(), line(1))
|
||||
// FPS count
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}FPS${ccG}${Gdx.graphics.framesPerSecond.toString().padStart(3, ' ')}",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}FPS${ccG}${Gdx.graphics.framesPerSecond.toString().padStart(3, ' ')}",
|
||||
(Terrarum.WIDTH - 3 - 15 * TinyAlphNum.W).toFloat(), line(2))
|
||||
|
||||
/**
|
||||
@@ -232,21 +232,21 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
*/
|
||||
|
||||
if (ingame != null) {
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}Actors total $ccG${ingame!!.actorContainerActive.size + ingame!!.actorContainerInactive.size}",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Actors total $ccG${ingame!!.actorContainerActive.size + ingame!!.actorContainerInactive.size}",
|
||||
TinyAlphNum.W * 2f, Terrarum.HEIGHT - TinyAlphNum.H * 2f)
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}Active $ccG${ingame!!.actorContainerActive.size}",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Active $ccG${ingame!!.actorContainerActive.size}",
|
||||
(TinyAlphNum.W * 2 + 17 * 8).toFloat(), Terrarum.HEIGHT - TinyAlphNum.H * 2f)
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}Dormant $ccG${ingame!!.actorContainerInactive.size}",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Dormant $ccG${ingame!!.actorContainerInactive.size}",
|
||||
(TinyAlphNum.W * 2 + 28 * 8).toFloat(), Terrarum.HEIGHT - TinyAlphNum.H * 2f)
|
||||
if (ingame is Ingame) {
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${(ingame as Ingame).particlesActive}",
|
||||
if (ingame is TerrarumIngame) {
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${(ingame as TerrarumIngame).particlesActive}",
|
||||
(TinyAlphNum.W * 2 + 41 * 8).toFloat(), Terrarum.HEIGHT - TinyAlphNum.H * 2f)
|
||||
}
|
||||
}
|
||||
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}Actors rendering $ccG${IngameRenderer.renderingActorsCount}",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}Actors rendering $ccG${IngameRenderer.renderingActorsCount}",
|
||||
TinyAlphNum.W * 2f, Terrarum.HEIGHT - TinyAlphNum.H * 3f)
|
||||
Terrarum.fontSmallNumbers.draw(batch, "${ccY}UIs rendering $ccG${IngameRenderer.renderingUIsCount}",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "${ccY}UIs rendering $ccG${IngameRenderer.renderingUIsCount}",
|
||||
TinyAlphNum.W * 2f + (21 * 8), Terrarum.HEIGHT - TinyAlphNum.H * 3f)
|
||||
|
||||
/**
|
||||
@@ -254,7 +254,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
*/
|
||||
|
||||
// processor and renderer
|
||||
Terrarum.fontSmallNumbers.draw(batch, "$ccY$totalHardwareName",
|
||||
AppLoader.fontSmallNumbers.draw(batch, "$ccY$totalHardwareName",
|
||||
(Terrarum.WIDTH - (totalHardwareName.length + 2) * TinyAlphNum.W).toFloat(), Terrarum.HEIGHT - TinyAlphNum.H * 2f)
|
||||
}
|
||||
|
||||
@@ -263,13 +263,13 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
private val totalHardwareName = "$processorName $rendererName"
|
||||
|
||||
private fun printLine(batch: SpriteBatch, l: Int, s: String) {
|
||||
Terrarum.fontSmallNumbers.draw(batch,
|
||||
AppLoader.fontSmallNumbers.draw(batch,
|
||||
s, TinyAlphNum.W * 2f, line(l)
|
||||
)
|
||||
}
|
||||
|
||||
private fun printLineColumn(batch: SpriteBatch, col: Int, row: Int, s: String) {
|
||||
Terrarum.fontSmallNumbers.draw(batch,
|
||||
AppLoader.fontSmallNumbers.draw(batch,
|
||||
s, (TinyAlphNum.W * 2f + column(col)), line(row)
|
||||
)
|
||||
}
|
||||
@@ -293,9 +293,9 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
batch.color = uiColour
|
||||
batch.fillRect(x.toFloat(), y.toFloat(), w.plus(1), h)
|
||||
batch.color = Color.GRAY
|
||||
Terrarum.fontSmallNumbers.draw(batch, "0", x.toFloat(), y.toFloat() + h + 2)
|
||||
Terrarum.fontSmallNumbers.draw(batch, "255", x.toFloat() + w + 1 - 8 * 3, y.toFloat() + h + 2)
|
||||
Terrarum.fontSmallNumbers.draw(batch, "Histogramme", x + w / 2 - 5.5f * 8, y.toFloat() + h + 2)
|
||||
AppLoader.fontSmallNumbers.draw(batch, "0", x.toFloat(), y.toFloat() + h + 2)
|
||||
AppLoader.fontSmallNumbers.draw(batch, "255", x.toFloat() + w + 1 - 8 * 3, y.toFloat() + h + 2)
|
||||
AppLoader.fontSmallNumbers.draw(batch, "Histogramme", x + w / 2 - 5.5f * 8, y.toFloat() + h + 2)
|
||||
|
||||
blendScreen(batch)
|
||||
for (c in 0..3) {
|
||||
@@ -342,7 +342,7 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
}
|
||||
batch.begin()
|
||||
|
||||
Terrarum.fontSmallNumbers.draw(batch, gamepad.getName(), Terrarum.WIDTH - (gamepad.getName().length + 2f) * TinyAlphNum.W, uiY.toFloat() + h + 2)
|
||||
AppLoader.fontSmallNumbers.draw(batch, gamepad.getName(), Terrarum.WIDTH - (gamepad.getName().length + 2f) * TinyAlphNum.W, uiY.toFloat() + h + 2)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,13 @@ import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.util.HistoryArray
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.console.Authenticator
|
||||
import net.torvald.terrarum.console.CommandInterpreter
|
||||
import net.torvald.terrarum.fillRect
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.util.HistoryArray
|
||||
|
||||
|
||||
/**
|
||||
@@ -58,12 +58,12 @@ class ConsoleWindow : UICanvas() {
|
||||
batch.fillRect(drawOffX, drawOffY, width.toFloat(), LINE_HEIGHT.toFloat())
|
||||
|
||||
val input = commandInputPool!!.toString()
|
||||
val inputDrawWidth = Terrarum.fontGame.getWidth(input)
|
||||
val inputDrawHeight = Terrarum.fontGame.lineHeight
|
||||
val inputDrawWidth = AppLoader.fontGame.getWidth(input)
|
||||
val inputDrawHeight = AppLoader.fontGame.lineHeight
|
||||
|
||||
// text and cursor
|
||||
batch.color = Color.WHITE
|
||||
Terrarum.fontGame.draw(batch, input, 1f + drawOffX, drawOffY)
|
||||
AppLoader.fontGame.draw(batch, input, 1f + drawOffX, drawOffY)
|
||||
|
||||
batch.color = Color(0x7f7f7f_ff)
|
||||
batch.fillRect(inputDrawWidth.toFloat() + drawOffX + 1, drawOffY, 2f, inputDrawHeight)
|
||||
@@ -74,7 +74,7 @@ class ConsoleWindow : UICanvas() {
|
||||
// messages
|
||||
for (i in 0..MESSAGES_DISPLAY_COUNT - 1) {
|
||||
val message = messages[messageDisplayPos + i]
|
||||
Terrarum.fontGame.draw(batch, message, 1f + drawOffX, (LINE_HEIGHT * (i + 1)).toFloat() + drawOffY)
|
||||
AppLoader.fontGame.draw(batch, message, 1f + drawOffX, (LINE_HEIGHT * (i + 1)).toFloat() + drawOffY)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ class ConsoleWindow : UICanvas() {
|
||||
commandInputPool = StringBuilder()
|
||||
|
||||
if (Authenticator.b()) {
|
||||
sendMessage("${Terrarum.NAME} ${AppLoader.getVERSION_STRING()}")
|
||||
sendMessage("${AppLoader.GAME_NAME} ${AppLoader.getVERSION_STRING()}")
|
||||
sendMessage(Lang["DEV_MESSAGE_CONSOLE_CODEX"])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
|
||||
/**
|
||||
* UIHandler is a handler for UICanvas. It opens/closes the attached UI, moves the "window" (or "canvas")
|
||||
@@ -279,7 +279,7 @@ class UIHandler(//var UI: UICanvas,
|
||||
}
|
||||
|
||||
fun setCameraPosition(batch: SpriteBatch, camera: Camera, newX: Float, newY: Float) {
|
||||
Ingame.setCameraPosition(batch, camera, newX, newY)
|
||||
TerrarumIngame.setCameraPosition(batch, camera, newX, newY)
|
||||
}
|
||||
|
||||
fun mouseMoved(uiItems: List<UIItem>, screenX: Int, screenY: Int): Boolean {
|
||||
|
||||
@@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.ui
|
||||
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.AppLoader
|
||||
import net.torvald.terrarum.floor
|
||||
import net.torvald.terrarum.ui.UIItemTextButton.Companion.Alignment
|
||||
|
||||
@@ -13,7 +13,7 @@ class UIItemTextArea(
|
||||
override val width: Int,
|
||||
override val height: Int,
|
||||
val lineGap: Int = 0,
|
||||
val lineCount: Int = ((height + lineGap) / Terrarum.fontGame.lineHeight).toInt(),
|
||||
val lineCount: Int = ((height + lineGap) / AppLoader.fontGame.lineHeight).toInt(),
|
||||
val align: Alignment = Alignment.LEFT
|
||||
) : UIItem(parentUI) {
|
||||
|
||||
@@ -40,12 +40,12 @@ class UIItemTextArea(
|
||||
for (i in scrollPos until minOf(lineCount + scrollPos, entireText.size)) {
|
||||
val yPtr = i - scrollPos
|
||||
|
||||
val textWidth = Terrarum.fontGame.getWidth(entireText[i])
|
||||
val textWidth = AppLoader.fontGame.getWidth(entireText[i])
|
||||
|
||||
when (align) {
|
||||
Alignment.LEFT -> Terrarum.fontGame.draw(batch, entireText[i], posX.toFloat(), posY + yPtr * (Terrarum.fontGame.lineHeight + lineGap))
|
||||
Alignment.CENTRE -> Terrarum.fontGame.draw(batch, entireText[i], posX + ((width - textWidth) / 2f).floor(), posY + yPtr * (Terrarum.fontGame.lineHeight + lineGap))
|
||||
Alignment.RIGHT -> Terrarum.fontGame.draw(batch, entireText[i], posX + width - textWidth.toFloat(), posY + yPtr * (Terrarum.fontGame.lineHeight + lineGap))
|
||||
Alignment.LEFT -> AppLoader.fontGame.draw(batch, entireText[i], posX.toFloat(), posY + yPtr * (AppLoader.fontGame.lineHeight + lineGap))
|
||||
Alignment.CENTRE -> AppLoader.fontGame.draw(batch, entireText[i], posX + ((width - textWidth) / 2f).floor(), posY + yPtr * (AppLoader.fontGame.lineHeight + lineGap))
|
||||
Alignment.RIGHT -> AppLoader.fontGame.draw(batch, entireText[i], posX + width - textWidth.toFloat(), posY + yPtr * (AppLoader.fontGame.lineHeight + lineGap))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.BlendMode
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.fillRect
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
@@ -53,7 +53,7 @@ open class UIItemTextButton(
|
||||
override var oldPosY = posY
|
||||
|
||||
companion object {
|
||||
val font = Terrarum.fontGame
|
||||
val font = AppLoader.fontGame
|
||||
val height = font.lineHeight.toInt()
|
||||
val defaultInactiveCol = Color.WHITE
|
||||
val defaultHighlightCol = Color(0x00f8ff_ff)
|
||||
|
||||
@@ -31,14 +31,14 @@ class UINSMenu(
|
||||
override var openCloseTime: Second = 0f
|
||||
val LINE_HEIGHT = 24
|
||||
val TEXT_OFFSETX = 3f
|
||||
val TEXT_OFFSETY = (LINE_HEIGHT - Terrarum.fontGame.lineHeight) / 2f
|
||||
val TEXT_OFFSETY = (LINE_HEIGHT - AppLoader.fontGame.lineHeight) / 2f
|
||||
val CHILD_ARROW = "${0x2023.toChar()}"
|
||||
|
||||
|
||||
val tree = treeRepresentation.parseAsYamlInvokable()
|
||||
override var width = 0
|
||||
override var height = 0
|
||||
//override var width = maxOf(minimumWidth, tree.getLevelData(1).map { Terrarum.fontGame.getWidth(it ?: "") }.max() ?: 0)
|
||||
//override var width = maxOf(minimumWidth, tree.getLevelData(1).map { AppLoader.fontGame.getWidth(it ?: "") }.max() ?: 0)
|
||||
//override var height = LINE_HEIGHT * (tree.children.size + 1)
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@ class UINSMenu(
|
||||
}
|
||||
|
||||
val listWidth = maxOf(
|
||||
Terrarum.fontGame.getWidth(menuTitle), minimumWidth,
|
||||
stringsFromTree.map { Terrarum.fontGame.getWidth(it) }.max() ?: 0
|
||||
AppLoader.fontGame.getWidth(menuTitle), minimumWidth,
|
||||
stringsFromTree.map { AppLoader.fontGame.getWidth(it) }.max() ?: 0
|
||||
)
|
||||
val uiWidth = listWidth + (2 * TEXT_OFFSETX.toInt())
|
||||
val listHeight = stringsFromTree.size * LINE_HEIGHT
|
||||
@@ -176,7 +176,7 @@ class UINSMenu(
|
||||
|
||||
batch.color = titleTextCol
|
||||
blendNormal(batch)
|
||||
Terrarum.fontGame.draw(batch, it.title, TEXT_OFFSETX + it.ui.posX, TEXT_OFFSETY + it.ui.posY - LINE_HEIGHT)
|
||||
AppLoader.fontGame.draw(batch, it.title, TEXT_OFFSETX + it.ui.posX, TEXT_OFFSETY + it.ui.posY - LINE_HEIGHT)
|
||||
|
||||
// draw the list
|
||||
batch.color = Color.WHITE
|
||||
|
||||
Reference in New Issue
Block a user