some font stuffs for ui

This commit is contained in:
minjaesong
2023-06-18 21:40:06 +09:00
parent a33f0e7ab4
commit 138c6d22d2
9 changed files with 17 additions and 13 deletions

View File

@@ -557,7 +557,7 @@ public class App implements ApplicationListener {
false,
64, false, 0.5f, false
);
fontUITitle.setInterchar(2);
fontUITitle.setInterchar(1);
fontGameFBO = new TerrarumSansBitmap(FONT_DIR, false, true, false,
false,
64, false, 203f/255f, false

View File

@@ -167,8 +167,11 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
options.forEachIndexed { index, strings ->
val mode = strings[2]
val font = if (mode == "h1") App.fontUITitle else App.fontGame
val label = (strings[1] as () -> String).invoke()
val labelWidth = App.fontGame.getWidth(label)
val labelWidth = font.getWidth(label)
batch.color = when (mode) {
"h1" -> Toolkit.Theme.COL_MOUSE_UP
"p" -> Color.LIGHT_GRAY
@@ -180,7 +183,7 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
else
drawX + width/2 - panelgap - labelWidth // right aligned at the middle of the panel, offsetted by panelgap
App.fontGame.draw(batch, label, xpos.toFloat(), drawY + optionsYpos[index] - 2f)
font.draw(batch, label, xpos.toFloat(), drawY + optionsYpos[index] - 2f)
// draw hrule
if (mode == "h1") {

View File

@@ -180,7 +180,7 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
// todo show "Keyboard"/"Gamepad" accordingly
val title = Lang["MENU_CONTROLS_KEYBOARD"]
batch.color = Color.WHITE
App.fontGame.draw(batch, title, drawX.toFloat() + (width - App.fontGame.getWidth(title)) / 2, drawY.toFloat())
App.fontUITitle.draw(batch, title, drawX.toFloat() + (width - App.fontUITitle.getWidth(title)) / 2, drawY.toFloat())
// button help for string input UI

View File

@@ -201,7 +201,9 @@ class UIKeyboardControlPanel(remoCon: UIRemoCon?) : UICanvas() {
// todo show "Keyboard"/"Gamepad" accordingly
batch.color = Color.WHITE
val title = Lang["MENU_CONTROLS_KEYBOARD"]
App.fontGame.draw(batch, title, drawX.toFloat() + (width - App.fontGame.getWidth(title)) / 2, drawY.toFloat())
App.fontUITitle.draw(batch, title, drawX.toFloat() + (width - App.fontUITitle.getWidth(title)) / 2, drawY.toFloat())
val desc = Lang["MENU_LABEL_KEYCONFIG_HELP1"]
App.fontGame.draw(batch, desc, drawX.toFloat() + (width - App.fontGame.getWidth(desc)) / 2, drawY + 360f)

View File

@@ -374,7 +374,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
// draw texts
val loadGameTitleStr = Lang[titles[mode]]// + "$EMDASH$hash"
// "Game Load"
App.fontUITitle.draw(batch, loadGameTitleStr, (width - App.fontGame.getWidth(loadGameTitleStr)).div(2).toFloat(), titleTextPosY.toFloat())
App.fontUITitle.draw(batch, loadGameTitleStr, (width - App.fontUITitle.getWidth(loadGameTitleStr)).div(2).toFloat(), titleTextPosY.toFloat())
// Control help
App.fontGame.draw(batch, controlHelp, uiX.toFloat(), controlHelperY.toFloat())
}

View File

@@ -107,7 +107,7 @@ class UINewCharacter(val remoCon: UIRemoCon) : UICanvas() {
batch.color = Color.WHITE
// ui title
// val titlestr = Lang["CONTEXT_WORLD_NEW"]
// App.fontUITitle.draw(batch, titlestr, drawX + (width - App.fontGame.getWidth(titlestr)).div(2).toFloat(), titleTextPosY.toFloat())
// App.fontUITitle.draw(batch, titlestr, drawX + (width - App.fontUITitle.getWidth(titlestr)).div(2).toFloat(), titleTextPosY.toFloat())
// name/seed input labels

View File

@@ -131,7 +131,7 @@ class UINewWorld(val remoCon: UIRemoCon) : UICanvas() {
batch.color = Color.WHITE
// ui title
// val titlestr = Lang["CONTEXT_WORLD_NEW"]
// App.fontUITitle.draw(batch, titlestr, drawX + (width - App.fontGame.getWidth(titlestr)).div(2).toFloat(), titleTextPosY.toFloat())
// App.fontUITitle.draw(batch, titlestr, drawX + (width - App.fontUITitle.getWidth(titlestr)).div(2).toFloat(), titleTextPosY.toFloat())
// draw size previews
val texture = tex[sizeSelector.selection.coerceAtMost(tex.lastIndex)]

View File

@@ -192,7 +192,7 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
// draw texts
val loadGameTitleStr = Lang["MENU_MODULES"]// + "$EMDASH$hash"
// "Game Load"
App.fontUITitle.draw(batch, loadGameTitleStr, (width - App.fontGame.getWidth(loadGameTitleStr)).div(2).toFloat(), titleTextPosY.toFloat())
App.fontUITitle.draw(batch, loadGameTitleStr, (width - App.fontUITitle.getWidth(loadGameTitleStr)).div(2).toFloat(), titleTextPosY.toFloat())
// Control help
App.fontGame.draw(batch, controlHelp, uiX.toFloat(), controlHelperY.toFloat())
}

View File

@@ -16,6 +16,7 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame
import net.torvald.terrarum.modulebasegame.WorldgenLoadScreen
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
import net.torvald.terrarum.modulebasegame.serialise.ReadActor
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y
import net.torvald.terrarum.savegame.ByteArray64Reader
import net.torvald.terrarum.savegame.VDFileID
import net.torvald.terrarum.savegame.VirtualDisk
@@ -53,8 +54,6 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
private val sizeSelY = 186 + 40
internal val titleTextPosY: Int = App.scr.tvSafeGraphicsHeight + 10
private val sizeSelector = UIItemInlineRadioButtons(this,
drawX + radioX, drawY + sizeSelY, radioCellWidth,
listOf(
@@ -149,8 +148,8 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
batch.color = Color.WHITE
// ui title
// val titlestr = Lang["CONTEXT_WORLD_NEW"]
// App.fontUITitle.draw(batch, titlestr, drawX + (width - App.fontGame.getWidth(titlestr)).div(2).toFloat(), titleTextPosY.toFloat())
val titlestr = Lang["CONTEXT_WORLD_SEARCH"]
App.fontUITitle.draw(batch, titlestr, drawX + (width - App.fontUITitle.getWidth(titlestr)).div(2).toFloat(), INVENTORY_CELLS_OFFSET_Y() - 72f)
// draw size previews
val texture = tex[sizeSelector.selection.coerceAtMost(tex.lastIndex)]