mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
some font stuffs for ui
This commit is contained in:
@@ -557,7 +557,7 @@ public class App implements ApplicationListener {
|
|||||||
false,
|
false,
|
||||||
64, false, 0.5f, false
|
64, false, 0.5f, false
|
||||||
);
|
);
|
||||||
fontUITitle.setInterchar(2);
|
fontUITitle.setInterchar(1);
|
||||||
fontGameFBO = new TerrarumSansBitmap(FONT_DIR, false, true, false,
|
fontGameFBO = new TerrarumSansBitmap(FONT_DIR, false, true, false,
|
||||||
false,
|
false,
|
||||||
64, false, 203f/255f, false
|
64, false, 203f/255f, false
|
||||||
|
|||||||
@@ -167,8 +167,11 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
|
|
||||||
options.forEachIndexed { index, strings ->
|
options.forEachIndexed { index, strings ->
|
||||||
val mode = strings[2]
|
val mode = strings[2]
|
||||||
|
|
||||||
|
val font = if (mode == "h1") App.fontUITitle else App.fontGame
|
||||||
|
|
||||||
val label = (strings[1] as () -> String).invoke()
|
val label = (strings[1] as () -> String).invoke()
|
||||||
val labelWidth = App.fontGame.getWidth(label)
|
val labelWidth = font.getWidth(label)
|
||||||
batch.color = when (mode) {
|
batch.color = when (mode) {
|
||||||
"h1" -> Toolkit.Theme.COL_MOUSE_UP
|
"h1" -> Toolkit.Theme.COL_MOUSE_UP
|
||||||
"p" -> Color.LIGHT_GRAY
|
"p" -> Color.LIGHT_GRAY
|
||||||
@@ -180,7 +183,7 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
else
|
else
|
||||||
drawX + width/2 - panelgap - labelWidth // right aligned at the middle of the panel, offsetted by panelgap
|
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
|
// draw hrule
|
||||||
if (mode == "h1") {
|
if (mode == "h1") {
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
// todo show "Keyboard"/"Gamepad" accordingly
|
// todo show "Keyboard"/"Gamepad" accordingly
|
||||||
val title = Lang["MENU_CONTROLS_KEYBOARD"]
|
val title = Lang["MENU_CONTROLS_KEYBOARD"]
|
||||||
batch.color = Color.WHITE
|
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
|
// button help for string input UI
|
||||||
|
|||||||
@@ -201,7 +201,9 @@ class UIKeyboardControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
// todo show "Keyboard"/"Gamepad" accordingly
|
// todo show "Keyboard"/"Gamepad" accordingly
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
val title = Lang["MENU_CONTROLS_KEYBOARD"]
|
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"]
|
val desc = Lang["MENU_LABEL_KEYCONFIG_HELP1"]
|
||||||
App.fontGame.draw(batch, desc, drawX.toFloat() + (width - App.fontGame.getWidth(desc)) / 2, drawY + 360f)
|
App.fontGame.draw(batch, desc, drawX.toFloat() + (width - App.fontGame.getWidth(desc)) / 2, drawY + 360f)
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
// draw texts
|
// draw texts
|
||||||
val loadGameTitleStr = Lang[titles[mode]]// + "$EMDASH$hash"
|
val loadGameTitleStr = Lang[titles[mode]]// + "$EMDASH$hash"
|
||||||
// "Game Load"
|
// "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
|
// Control help
|
||||||
App.fontGame.draw(batch, controlHelp, uiX.toFloat(), controlHelperY.toFloat())
|
App.fontGame.draw(batch, controlHelp, uiX.toFloat(), controlHelperY.toFloat())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class UINewCharacter(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
// ui title
|
// ui title
|
||||||
// val titlestr = Lang["CONTEXT_WORLD_NEW"]
|
// 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
|
// name/seed input labels
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class UINewWorld(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
// ui title
|
// ui title
|
||||||
// val titlestr = Lang["CONTEXT_WORLD_NEW"]
|
// 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
|
// draw size previews
|
||||||
val texture = tex[sizeSelector.selection.coerceAtMost(tex.lastIndex)]
|
val texture = tex[sizeSelector.selection.coerceAtMost(tex.lastIndex)]
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
|
|||||||
// draw texts
|
// draw texts
|
||||||
val loadGameTitleStr = Lang["MENU_MODULES"]// + "$EMDASH$hash"
|
val loadGameTitleStr = Lang["MENU_MODULES"]// + "$EMDASH$hash"
|
||||||
// "Game Load"
|
// "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
|
// Control help
|
||||||
App.fontGame.draw(batch, controlHelp, uiX.toFloat(), controlHelperY.toFloat())
|
App.fontGame.draw(batch, controlHelp, uiX.toFloat(), controlHelperY.toFloat())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
|||||||
import net.torvald.terrarum.modulebasegame.WorldgenLoadScreen
|
import net.torvald.terrarum.modulebasegame.WorldgenLoadScreen
|
||||||
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
||||||
import net.torvald.terrarum.modulebasegame.serialise.ReadActor
|
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.ByteArray64Reader
|
||||||
import net.torvald.terrarum.savegame.VDFileID
|
import net.torvald.terrarum.savegame.VDFileID
|
||||||
import net.torvald.terrarum.savegame.VirtualDisk
|
import net.torvald.terrarum.savegame.VirtualDisk
|
||||||
@@ -53,8 +54,6 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
|
|||||||
|
|
||||||
private val sizeSelY = 186 + 40
|
private val sizeSelY = 186 + 40
|
||||||
|
|
||||||
internal val titleTextPosY: Int = App.scr.tvSafeGraphicsHeight + 10
|
|
||||||
|
|
||||||
private val sizeSelector = UIItemInlineRadioButtons(this,
|
private val sizeSelector = UIItemInlineRadioButtons(this,
|
||||||
drawX + radioX, drawY + sizeSelY, radioCellWidth,
|
drawX + radioX, drawY + sizeSelY, radioCellWidth,
|
||||||
listOf(
|
listOf(
|
||||||
@@ -149,8 +148,8 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
|
|||||||
|
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
// ui title
|
// ui title
|
||||||
// val titlestr = Lang["CONTEXT_WORLD_NEW"]
|
val titlestr = Lang["CONTEXT_WORLD_SEARCH"]
|
||||||
// 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(), INVENTORY_CELLS_OFFSET_Y() - 72f)
|
||||||
|
|
||||||
// draw size previews
|
// draw size previews
|
||||||
val texture = tex[sizeSelector.selection.coerceAtMost(tex.lastIndex)]
|
val texture = tex[sizeSelector.selection.coerceAtMost(tex.lastIndex)]
|
||||||
|
|||||||
Reference in New Issue
Block a user