module option window title to match the y-pos of others

This commit is contained in:
minjaesong
2023-11-14 13:07:43 +09:00
parent 8d394cc085
commit 7391d5e43a
2 changed files with 10 additions and 7 deletions

View File

@@ -23,7 +23,7 @@ class ModOptionsHost(val remoCon: UIRemoCon) : UICanvas() {
private val moduleAreaBorder = 8
override var width = 560
override var height = App.scr.height - moduleAreaHMargin * 2
override var height = 600//App.scr.height - moduleAreaHMargin * 2
private val drawX = (Toolkit.drawWidth - width) / 2
private val drawY = (App.scr.height - height) / 2
@@ -35,7 +35,7 @@ class ModOptionsHost(val remoCon: UIRemoCon) : UICanvas() {
private val modSelectorWidth = 360
private val modSelector = UIItemTextSelector(this, drawX + (width - modSelectorWidth) / 2, drawY,
configurableMods.map { { it.first } }, 0, modSelectorWidth, false
configurableMods.map { { it.first } }, 0, modSelectorWidth, false, font = App.fontUITitle
).also { item ->
item.selectionChangeListener = {
currentlySelectedModule = configurableMods[it].second

View File

@@ -4,11 +4,13 @@ import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.g2d.BitmapFont
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.FrameBuffer
import net.torvald.terrarum.*
import net.torvald.terrarum.App.printdbg
import net.torvald.terrarum.gameworld.fmod
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap
/**
* @param width width of the text input where the text gets drawn, not the entire item
@@ -25,6 +27,7 @@ class UIItemTextSelector(
private val drawBorder: Boolean = true,
private val clickToShowPalette: Boolean = true,
private val useSpinnerButtons: Boolean = false,
private val font: TerrarumSansBitmap = App.fontGame
) : UIItem(parentUI, initialX, initialY) {
init {
@@ -143,7 +146,7 @@ class UIItemTextSelector(
it.color = Color.WHITE
val t = labelCache[selection]
val tw = App.fontGame.getWidth(t)
val tw = font.getWidth(t)
printdbg(this, "Drawing text: $t")
@@ -199,9 +202,9 @@ class UIItemTextSelector(
if (!paletteShowing) {
batch.color = UIItemTextLineInput.TEXTINPUT_COL_TEXT
val t = labelCache[selection]
val tw = App.fontGame.getWidth(t)
val tw = font.getWidth(t)
// batch.draw(fbo.colorBufferTexture, posX + buttonW + 3f, posY + 2f, fbo.width.toFloat(), fbo.height.toFloat())
App.fontGame.draw(batch, t, posX + buttonW + 3 + (fboWidth - tw) / 2, posY)
font.draw(batch, t, posX + buttonW + 3 + (fboWidth - tw) / 2, posY)
}
// palette
else {
@@ -227,8 +230,8 @@ class UIItemTextSelector(
else if (index == mouseOnPaletteItem) Toolkit.Theme.COL_MOUSE_UP
else UIItemTextLineInput.TEXTINPUT_COL_TEXT
val t = labelCache[index]
val tw = App.fontGame.getWidth(t)
App.fontGame.draw(batch, t,
val tw = font.getWidth(t)
font.draw(batch, t,
palX + (palW - tw) / 2,
getPalItemPosY(index) - 2
)