mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 21:14:04 +09:00
bigger click hitbox for titlescreen uiremocon
This commit is contained in:
@@ -1,43 +0,0 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
|
||||||
|
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
|
||||||
import com.badlogic.gdx.utils.Disposable
|
|
||||||
import net.torvald.terrarum.App
|
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by minjaesong on 2019-05-24.
|
|
||||||
*/
|
|
||||||
object FloatDrawer : Disposable {
|
|
||||||
|
|
||||||
val tile = TextureRegionPack("assets/graphics/gui/message_black_tileable.tga", 36, 36)
|
|
||||||
|
|
||||||
init {
|
|
||||||
App.disposableSingletonsPool.add(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws the Float at given position in given size. The size is that of the centre area, excluding the edges. Size of the edges are 8x8 pixels.
|
|
||||||
*/
|
|
||||||
operator fun invoke(batch: SpriteBatch, x: Float, y: Float, w: Float, h: Float) {
|
|
||||||
// centre area
|
|
||||||
batch.draw(tile.get(1, 1), x, y, w, h)
|
|
||||||
|
|
||||||
// edges
|
|
||||||
batch.draw(tile.get(1, 0), x, y - tile.tileH, w, tile.tileH.toFloat())
|
|
||||||
batch.draw(tile.get(1, 2), x, y + h, w, tile.tileH.toFloat())
|
|
||||||
batch.draw(tile.get(0, 1), x - tile.tileW, y, tile.tileW.toFloat(), h)
|
|
||||||
batch.draw(tile.get(2, 1), x + w, y, tile.tileW.toFloat(), h)
|
|
||||||
|
|
||||||
// corners
|
|
||||||
batch.draw(tile.get(0, 0), x - tile.tileW, y - tile.tileH)
|
|
||||||
batch.draw(tile.get(2, 0), x + w, y - tile.tileH)
|
|
||||||
batch.draw(tile.get(2, 2), x + w, y + h)
|
|
||||||
batch.draw(tile.get(0, 2), x - tile.tileW, y + h)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun dispose() {
|
|
||||||
tile.dispose()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
|||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
import net.torvald.terrarum.blendNormal
|
import net.torvald.terrarum.blendNormal
|
||||||
|
import net.torvald.terrarum.ui.Toolkit
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,7 +68,7 @@ class Notification : UICanvas() {
|
|||||||
|
|
||||||
batch.color = drawColor
|
batch.color = drawColor
|
||||||
|
|
||||||
FloatDrawer(batch, 0f, -textHeight, displayedTextWidth.toFloat(), textHeight)
|
Toolkit.drawBaloon(batch, 0f, -textHeight, displayedTextWidth.toFloat(), textHeight)
|
||||||
|
|
||||||
batch.color = fontCol
|
batch.color = fontCol
|
||||||
message.forEachIndexed { index, s ->
|
message.forEachIndexed { index, s ->
|
||||||
|
|||||||
@@ -116,8 +116,7 @@ class UIKeyboardControlPanel : UICanvas() {
|
|||||||
-4 to UIItemKeycap(this, 401,129, null, oneu, ""),
|
-4 to UIItemKeycap(this, 401,129, null, oneu, ""),
|
||||||
Input.Keys.CONTROL_RIGHT to UIItemKeycap(this, 433,129, Input.Keys.CONTROL_RIGHT, onehalfu, "21,3"),
|
Input.Keys.CONTROL_RIGHT to UIItemKeycap(this, 433,129, Input.Keys.CONTROL_RIGHT, onehalfu, "21,3"),
|
||||||
|
|
||||||
// ...
|
) // end of keycaps
|
||||||
)
|
|
||||||
|
|
||||||
private val symbolLeft = labels.get(0,2)
|
private val symbolLeft = labels.get(0,2)
|
||||||
private val symbolUp = labels.get(1,2)
|
private val symbolUp = labels.get(1,2)
|
||||||
@@ -129,6 +128,7 @@ class UIKeyboardControlPanel : UICanvas() {
|
|||||||
private val symbolGrapplingHook = labels.get(5,1)
|
private val symbolGrapplingHook = labels.get(5,1)
|
||||||
private val symbolGamemenu = labels.get(6,2)
|
private val symbolGamemenu = labels.get(6,2)
|
||||||
|
|
||||||
|
private val controlPalette = UIItemControlPaletteBaloon(this, (App.scr.width - 480) / 2, kby + 199)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
keycaps.values.forEach { addUIitem(it) }
|
keycaps.values.forEach { addUIitem(it) }
|
||||||
@@ -147,8 +147,26 @@ class UIKeyboardControlPanel : UICanvas() {
|
|||||||
keycaps[App.getConfigInt("control_key_gamemenu")]?.symbolControl = symbolGamemenu
|
keycaps[App.getConfigInt("control_key_gamemenu")]?.symbolControl = symbolGamemenu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal var keycapClicked = -13372
|
||||||
|
set(value) {
|
||||||
|
if (field != value) keycaps[field]?.selected = false
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
internal var controlSelected = -1
|
||||||
|
|
||||||
override fun updateUI(delta: Float) {
|
override fun updateUI(delta: Float) {
|
||||||
uiItems.forEach { it.update(delta) }
|
uiItems.forEach {
|
||||||
|
it.update(delta)
|
||||||
|
if (it is UIItemKeycap && it.mousePushed) {
|
||||||
|
it.selected = true
|
||||||
|
// println("key ${it.key}; selected = ${it.selected}")
|
||||||
|
keycapClicked = it.key ?: -13372
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keycapClicked >= 0 && controlSelected < 0) {
|
||||||
|
controlPalette.update(delta)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
@@ -159,6 +177,12 @@ class UIKeyboardControlPanel : UICanvas() {
|
|||||||
uiItems.forEach { it.render(batch, camera) }
|
uiItems.forEach { it.render(batch, camera) }
|
||||||
|
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
|
|
||||||
|
if (keycapClicked >= 0 && controlSelected < 0) {
|
||||||
|
controlPalette.render(batch, camera)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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.fontGame.draw(batch, title, drawX.toFloat() + (width - App.fontGame.getWidth(title)) / 2, drawY.toFloat())
|
||||||
|
|
||||||
@@ -207,11 +231,13 @@ class UIItemKeycap(
|
|||||||
private val s1 = if (symbolDefault.isNotBlank()) symbolDefault.split(',').map { it.toInt() } else null
|
private val s1 = if (symbolDefault.isNotBlank()) symbolDefault.split(',').map { it.toInt() } else null
|
||||||
|
|
||||||
var symbolControl: TextureRegion? = null
|
var symbolControl: TextureRegion? = null
|
||||||
|
var selected = false
|
||||||
|
|
||||||
private val borderKeyForbidden = Color(0x000000C0)
|
private val borderKeyForbidden = Color(0x000000C0)
|
||||||
private val borderKeyNormal = Color(0xFFFFFFAA.toInt())
|
private val borderKeyNormal = Color(0xFFFFFFAA.toInt())
|
||||||
private val borderMouseUp = UIItemTextButton.defaultActiveCol
|
private val borderMouseUp = UIItemTextButton.defaultActiveCol
|
||||||
private val borderKeyPressed = UIItemTextButton.defaultHighlightCol
|
private val borderKeyPressed = UIItemTextButton.defaultHighlightCol
|
||||||
|
private val borderKeyPressedAndSelected = Color(0x33FF33FF.toInt())
|
||||||
|
|
||||||
private val keycapFill = Color(0x404040_C0)
|
private val keycapFill = Color(0x404040_C0)
|
||||||
|
|
||||||
@@ -227,7 +253,9 @@ class UIItemKeycap(
|
|||||||
|
|
||||||
batch.color = if (key == null)
|
batch.color = if (key == null)
|
||||||
borderKeyForbidden
|
borderKeyForbidden
|
||||||
else if (Gdx.input.isKeyPressed(key))
|
else if (Gdx.input.isKeyPressed(key) && selected)
|
||||||
|
borderKeyPressedAndSelected
|
||||||
|
else if (Gdx.input.isKeyPressed(key) || selected)
|
||||||
borderKeyPressed
|
borderKeyPressed
|
||||||
else if (mouseUp)
|
else if (mouseUp)
|
||||||
borderMouseUp
|
borderMouseUp
|
||||||
@@ -260,3 +288,26 @@ class UIItemKeycap(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class UIItemControlPaletteBaloon(val parent: UIKeyboardControlPanel, initialX: Int, initialY: Int) : UIItem(parent, initialX, initialY) {
|
||||||
|
override val width = 480
|
||||||
|
override val height = 240
|
||||||
|
override fun dispose() {}
|
||||||
|
|
||||||
|
|
||||||
|
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||||
|
super.render(batch, camera)
|
||||||
|
|
||||||
|
Toolkit.drawBaloon(batch, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun update(delta: Float) {
|
||||||
|
super.update(delta) // unlatches mouse
|
||||||
|
|
||||||
|
|
||||||
|
// close
|
||||||
|
if (!mouseLatched && mousePushed) {
|
||||||
|
mouseLatched = true
|
||||||
|
parent.keycapClicked = -13372
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -258,14 +258,15 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
|
|||||||
class UIRemoConElement(uiRemoCon: UIRemoCon, val labels: Array<String>, val tags: Array<Array<String>>) {
|
class UIRemoConElement(uiRemoCon: UIRemoCon, val labels: Array<String>, val tags: Array<Array<String>>) {
|
||||||
|
|
||||||
private val lineHeight = 36
|
private val lineHeight = 36
|
||||||
|
private val paddingLeft = 48
|
||||||
|
|
||||||
private val menubar = UIItemTextButtonList(
|
private val menubar = UIItemTextButtonList(
|
||||||
uiRemoCon,
|
uiRemoCon,
|
||||||
lineHeight,
|
lineHeight,
|
||||||
labels,
|
labels,
|
||||||
menubarOffX,
|
menubarOffX - paddingLeft,
|
||||||
menubarOffY - lineHeight * labels.size + 16,
|
menubarOffY - lineHeight * labels.size + 16,
|
||||||
uiRemoCon.width, getRemoConHeight(labels),
|
uiRemoCon.width + paddingLeft, getRemoConHeight(labels),
|
||||||
textAreaWidth = uiRemoCon.width,
|
textAreaWidth = uiRemoCon.width,
|
||||||
readFromLang = true,
|
readFromLang = true,
|
||||||
activeBackCol = Color(0),//Color(1f,0f,.75f,1f),
|
activeBackCol = Color(0),//Color(1f,0f,.75f,1f),
|
||||||
@@ -275,6 +276,7 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
|
|||||||
defaultSelection = null,
|
defaultSelection = null,
|
||||||
itemHitboxSize = lineHeight - 2,
|
itemHitboxSize = lineHeight - 2,
|
||||||
alignment = UIItemTextButton.Companion.Alignment.LEFT,
|
alignment = UIItemTextButton.Companion.Alignment.LEFT,
|
||||||
|
leftPadding = paddingLeft,
|
||||||
tagsCollection = tags
|
tagsCollection = tags
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -302,7 +304,7 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val remoConWidth = 300
|
val remoConWidth = 160
|
||||||
fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
fun getRemoConHeight(menu: ArrayList<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
||||||
fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
fun getRemoConHeight(menu: Array<String>) = DEFAULT_LINE_HEIGHT * menu.size.plus(1)
|
||||||
val menubarOffX: Int; get() = (0.11 * App.scr.width).toInt()
|
val menubarOffX: Int; get() = (0.11 * App.scr.width).toInt()
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
|||||||
import net.torvald.terrarum.App
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.Second
|
import net.torvald.terrarum.Second
|
||||||
import net.torvald.terrarum.Terrarum
|
import net.torvald.terrarum.Terrarum
|
||||||
|
import net.torvald.terrarum.ui.Toolkit
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,10 +35,10 @@ class UITooltip : UICanvas() {
|
|||||||
val textMarginX = 4
|
val textMarginX = 4
|
||||||
|
|
||||||
override var width: Int
|
override var width: Int
|
||||||
get() = msgWidth + (textMarginX + FloatDrawer.tile.tileW) * 2
|
get() = msgWidth + (textMarginX + Toolkit.baloonTile.tileW) * 2
|
||||||
set(value) { throw Error("You are not supposed to set the width of the tooltip manually.") }
|
set(value) { throw Error("You are not supposed to set the width of the tooltip manually.") }
|
||||||
override var height: Int
|
override var height: Int
|
||||||
get() = FloatDrawer.tile.tileH * 2 + font.lineHeight.toInt()
|
get() = Toolkit.baloonTile.tileH * 2 + font.lineHeight.toInt()
|
||||||
set(value) { throw Error("You are not supposed to set the height of the tooltip manually.") }
|
set(value) { throw Error("You are not supposed to set the height of the tooltip manually.") }
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||||
@@ -54,7 +55,7 @@ class UITooltip : UICanvas() {
|
|||||||
|
|
||||||
batch.color = tooltipBackCol
|
batch.color = tooltipBackCol
|
||||||
|
|
||||||
FloatDrawer(batch,
|
Toolkit.drawBaloon(batch,
|
||||||
tooltipX - textMarginX,
|
tooltipX - textMarginX,
|
||||||
tooltipY,
|
tooltipY,
|
||||||
tooltipW,
|
tooltipW,
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import com.badlogic.gdx.graphics.OrthographicCamera
|
|||||||
import com.badlogic.gdx.graphics.Pixmap
|
import com.badlogic.gdx.graphics.Pixmap
|
||||||
import com.badlogic.gdx.graphics.Texture
|
import com.badlogic.gdx.graphics.Texture
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
import com.badlogic.gdx.utils.Disposable
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.App
|
||||||
|
import net.torvald.terrarum.CommonResourcePool
|
||||||
|
import net.torvald.terrarum.fillRect
|
||||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
|
|
||||||
@@ -15,19 +17,29 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
|||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2016-08-04.
|
* Created by minjaesong on 2016-08-04.
|
||||||
*/
|
*/
|
||||||
object Toolkit {
|
object Toolkit : Disposable {
|
||||||
|
|
||||||
val DEFAULT_BOX_BORDER_COL = Color(1f, 1f, 1f, 0.2f)
|
val DEFAULT_BOX_BORDER_COL = Color(1f, 1f, 1f, 0.2f)
|
||||||
|
|
||||||
private val shaderBlur = App.loadShaderFromFile("assets/blur.vert", "assets/blur2.frag")
|
private val shaderBlur = App.loadShaderFromFile("assets/blur.vert", "assets/blur2.frag")
|
||||||
|
val baloonTile = TextureRegionPack("assets/graphics/gui/message_black_tileable.tga", 36, 36)
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
App.disposableSingletonsPool.add(this)
|
||||||
|
|
||||||
CommonResourcePool.addToLoadingList("toolkit_box_border") {
|
CommonResourcePool.addToLoadingList("toolkit_box_border") {
|
||||||
TextureRegionPack(Gdx.files.internal("./assets/graphics/gui/box_border_flat_tileable.tga"), 1, 1)
|
TextureRegionPack(Gdx.files.internal("./assets/graphics/gui/box_border_flat_tileable.tga"), 1, 1)
|
||||||
}
|
}
|
||||||
CommonResourcePool.loadAll()
|
CommonResourcePool.loadAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun dispose() {
|
||||||
|
baloonTile.dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun drawCentered(batch: SpriteBatch, image: Texture, screenPosY: Int, ui: UICanvas? = null) {
|
fun drawCentered(batch: SpriteBatch, image: Texture, screenPosY: Int, ui: UICanvas? = null) {
|
||||||
val imageW = image.width
|
val imageW = image.width
|
||||||
val targetW = if (ui == null) App.scr.width else ui.width
|
val targetW = if (ui == null) App.scr.width else ui.width
|
||||||
@@ -98,4 +110,21 @@ object Toolkit {
|
|||||||
batch.shader = null
|
batch.shader = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun drawBaloon(batch: SpriteBatch, x: Float, y: Float, w: Float, h: Float) {
|
||||||
|
// centre area
|
||||||
|
batch.draw(baloonTile.get(1, 1), x, y, w, h)
|
||||||
|
|
||||||
|
// edges
|
||||||
|
batch.draw(baloonTile.get(1, 0), x, y - baloonTile.tileH, w, baloonTile.tileH.toFloat())
|
||||||
|
batch.draw(baloonTile.get(1, 2), x, y + h, w, baloonTile.tileH.toFloat())
|
||||||
|
batch.draw(baloonTile.get(0, 1), x - baloonTile.tileW, y, baloonTile.tileW.toFloat(), h)
|
||||||
|
batch.draw(baloonTile.get(2, 1), x + w, y, baloonTile.tileW.toFloat(), h)
|
||||||
|
|
||||||
|
// corners
|
||||||
|
batch.draw(baloonTile.get(0, 0), x - baloonTile.tileW, y - baloonTile.tileH)
|
||||||
|
batch.draw(baloonTile.get(2, 0), x + w, y - baloonTile.tileH)
|
||||||
|
batch.draw(baloonTile.get(2, 2), x + w, y + h)
|
||||||
|
batch.draw(baloonTile.get(0, 2), x - baloonTile.tileW, y + h)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ abstract class UIItem(var parentUI: UICanvas, val initialX: Int, val initialY: I
|
|||||||
get() = mouseUp && Gdx.input.isButtonPressed(mouseButton)
|
get() = mouseUp && Gdx.input.isButtonPressed(mouseButton)
|
||||||
|
|
||||||
|
|
||||||
private var mouseLatched = Gdx.input.isButtonPressed(mouseButton)
|
protected var mouseLatched = Gdx.input.isButtonPressed(mouseButton)
|
||||||
|
|
||||||
/** UI to call (show up) while mouse is up */
|
/** UI to call (show up) while mouse is up */
|
||||||
open val mouseOverCall: UICanvas? = null
|
open val mouseOverCall: UICanvas? = null
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ open class UIItemTextButton(
|
|||||||
val backgroundBlendMode: String = BlendMode.NORMAL,
|
val backgroundBlendMode: String = BlendMode.NORMAL,
|
||||||
|
|
||||||
|
|
||||||
val preGapX: Int = 0,
|
val paddingLeft: Int = 0,
|
||||||
val postGapX: Int = 0,
|
val paddingRight: Int = 0,
|
||||||
|
|
||||||
val alignment: Alignment = Alignment.CENTRE,
|
val alignment: Alignment = Alignment.CENTRE,
|
||||||
val hitboxSize: Int = UIItemTextButton.height,
|
val hitboxSize: Int = UIItemTextButton.height,
|
||||||
@@ -109,9 +109,9 @@ open class UIItemTextButton(
|
|||||||
label,
|
label,
|
||||||
// "$label/H:${highlighted.toInt()}, M:${mouseUp.toInt()}",
|
// "$label/H:${highlighted.toInt()}, M:${mouseUp.toInt()}",
|
||||||
when (alignment) {
|
when (alignment) {
|
||||||
Alignment.CENTRE -> posX.toFloat() + width.minus(textW).div(2) + (preGapX - postGapX).div(2)
|
Alignment.CENTRE -> posX.toFloat() + width.minus(textW).div(2) + (paddingLeft - paddingRight).div(2)
|
||||||
Alignment.LEFT -> posX.toFloat() + preGapX
|
Alignment.LEFT -> posX.toFloat() + paddingLeft
|
||||||
Alignment.RIGHT -> width - postGapX - textW.toFloat()
|
Alignment.RIGHT -> width - paddingRight - textW.toFloat()
|
||||||
},
|
},
|
||||||
posY.toFloat() + (hitboxSize - UIItemTextButton.height) / 2f
|
posY.toFloat() + (hitboxSize - UIItemTextButton.height) / 2f
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ class UIItemTextButtonList(
|
|||||||
|
|
||||||
val kinematic: Boolean = false,
|
val kinematic: Boolean = false,
|
||||||
|
|
||||||
|
val leftPadding: Int = 0,
|
||||||
|
val rightPadding: Int = 0,
|
||||||
|
|
||||||
val alignment: UIItemTextButton.Companion.Alignment = UIItemTextButton.Companion.Alignment.CENTRE,
|
val alignment: UIItemTextButton.Companion.Alignment = UIItemTextButton.Companion.Alignment.CENTRE,
|
||||||
val itemHitboxSize: Int = lineHeight,
|
val itemHitboxSize: Int = lineHeight,
|
||||||
tagsCollection: Array<Array<String>> = Array(labelsList.size) { arrayOf("") }
|
tagsCollection: Array<Array<String>> = Array(labelsList.size) { arrayOf("") }
|
||||||
@@ -70,8 +73,8 @@ class UIItemTextButtonList(
|
|||||||
|
|
||||||
// zero if iconSpriteSheet is null
|
// zero if iconSpriteSheet is null
|
||||||
val iconsWithGap: Int = iconToTextGap + iconCellWidth
|
val iconsWithGap: Int = iconToTextGap + iconCellWidth
|
||||||
val pregap = (width - textAreaWidth - iconsWithGap) / 2 + iconsWithGap
|
val pregap = (width - textAreaWidth - iconsWithGap) / 2 + iconsWithGap + leftPadding
|
||||||
val postgap = (width - textAreaWidth - iconsWithGap) / 2
|
val postgap = (width - textAreaWidth - iconsWithGap) / 2 + rightPadding
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -99,8 +102,8 @@ class UIItemTextButtonList(
|
|||||||
inactiveCol = inactiveCol,
|
inactiveCol = inactiveCol,
|
||||||
backgroundCol = backgroundCol,
|
backgroundCol = backgroundCol,
|
||||||
backgroundBlendMode = backgroundBlendMode,
|
backgroundBlendMode = backgroundBlendMode,
|
||||||
preGapX = pregap,
|
paddingLeft = pregap,
|
||||||
postGapX = postgap,
|
paddingRight = postgap,
|
||||||
alignment = alignment,
|
alignment = alignment,
|
||||||
hitboxSize = itemHitboxSize,
|
hitboxSize = itemHitboxSize,
|
||||||
tags = tagsCollection[i]
|
tags = tagsCollection[i]
|
||||||
@@ -121,8 +124,8 @@ class UIItemTextButtonList(
|
|||||||
highlightBackBlendMode = activeBackBlendMode, // we are using custom highlighter
|
highlightBackBlendMode = activeBackBlendMode, // we are using custom highlighter
|
||||||
backgroundCol = Color(0),
|
backgroundCol = Color(0),
|
||||||
inactiveCol = inactiveCol,
|
inactiveCol = inactiveCol,
|
||||||
preGapX = pregap,
|
paddingLeft = pregap,
|
||||||
postGapX = postgap,
|
paddingRight = postgap,
|
||||||
alignment = alignment,
|
alignment = alignment,
|
||||||
hitboxSize = itemHitboxSize,
|
hitboxSize = itemHitboxSize,
|
||||||
tags = tagsCollection[i]
|
tags = tagsCollection[i]
|
||||||
|
|||||||
Reference in New Issue
Block a user