fix: storage chest ui would be shifted to left and any mouse button would trigger the action

This commit is contained in:
minjaesong
2023-06-17 23:19:09 +09:00
parent 0ff71f39fe
commit 4cc52b5585
10 changed files with 112 additions and 60 deletions

View File

@@ -42,6 +42,7 @@ import net.torvald.terrarum.savegame.VDUtil
import net.torvald.terrarum.savegame.VirtualDisk import net.torvald.terrarum.savegame.VirtualDisk
import net.torvald.terrarum.serialise.Common import net.torvald.terrarum.serialise.Common
import net.torvald.terrarum.ui.Toolkit import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.Toolkit.hdrawWidth
import net.torvald.terrarum.ui.UIAutosaveNotifier import net.torvald.terrarum.ui.UIAutosaveNotifier
import net.torvald.terrarum.ui.UICanvas import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.weather.WeatherMixer import net.torvald.terrarum.weather.WeatherMixer
@@ -521,7 +522,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
// pie menu // pie menu
uiPieMenu = UIQuickslotPie() uiPieMenu = UIQuickslotPie()
uiPieMenu.setPosition(drawWidth / 2, App.scr.halfh) uiPieMenu.setPosition(hdrawWidth, App.scr.halfh)
// vital metre // vital metre
// fill in getter functions by // fill in getter functions by

View File

@@ -58,6 +58,9 @@ class UIInventoryFull(
val INVENTORY_CELLS_OFFSET_X = { 0 + (Toolkit.drawWidth - internalWidth) / 2 } val INVENTORY_CELLS_OFFSET_X = { 0 + (Toolkit.drawWidth - internalWidth) / 2 }
val INVENTORY_CELLS_OFFSET_Y = { -YPOS_CORRECTION + 107 + (App.scr.height - internalHeight) / 2 } val INVENTORY_CELLS_OFFSET_Y = { -YPOS_CORRECTION + 107 + (App.scr.height - internalHeight) / 2 }
fun getWidthOfCells(count: Int, cellWidth: Int = UIItemInventoryElemWide.height, gapWidth: Int = UIItemInventoryItemGrid.listGap) =
(cellWidth * count) + (gapWidth * (count - 1))
val catBarWidth = 330 val catBarWidth = 330
val gradStartCol = Color(0x404040_60) val gradStartCol = Color(0x404040_60)

View File

@@ -145,35 +145,37 @@ open class UIItemInventoryItemGrid(
fun createInvCellGenericTouchDownFun(listRebuildFun: () -> Unit): (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit { fun createInvCellGenericTouchDownFun(listRebuildFun: () -> Unit): (GameItem?, Long, Int, Any?, UIItemInventoryCellBase) -> Unit {
return { item: GameItem?, amount: Long, button: Int, _, _ -> return { item: GameItem?, amount: Long, button: Int, _, _ ->
if (item != null && Terrarum.ingame != null) { if (button == App.getConfigInt("config_mouseprimary")) {
// equip da shit if (item != null && Terrarum.ingame != null) {
val itemEquipSlot = item.equipPosition // equip da shit
if (itemEquipSlot == GameItem.EquipPosition.NULL) { val itemEquipSlot = item.equipPosition
TODO("Equip position is NULL, does this mean it's single-consume items like a potion? (from item: \"$item\" with itemID: ${item.originalID}/${item.dynamicID})") if (itemEquipSlot == GameItem.EquipPosition.NULL) {
} TODO("Equip position is NULL, does this mean it's single-consume items like a potion? (from item: \"$item\" with itemID: ${item.originalID}/${item.dynamicID})")
val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
if (player != null) {
if (item != ItemCodex[player.inventory.itemEquipped.get(itemEquipSlot)]) { // if this item is unequipped, equip it
player.equipItem(item)
// also equip on the quickslot
player.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)?.let {
player.inventory.setQuickslotItem(it, item.dynamicID)
}
} }
else { // if not, unequip it val player = (Terrarum.ingame!! as TerrarumIngame).actorNowPlaying
player.unequipItem(item) if (player != null) {
// also unequip on the quickslot if (item != ItemCodex[player.inventory.itemEquipped.get(itemEquipSlot)]) { // if this item is unequipped, equip it
player.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)?.let { player.equipItem(item)
player.inventory.setQuickslotItem(it, null)
// also equip on the quickslot
player.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)?.let {
player.inventory.setQuickslotItem(it, item.dynamicID)
}
}
else { // if not, unequip it
player.unequipItem(item)
// also unequip on the quickslot
player.actorValue.getAsInt(AVKey.__PLAYER_QUICKSLOTSEL)?.let {
player.inventory.setQuickslotItem(it, null)
}
} }
} }
} }
listRebuildFun()
} }
listRebuildFun()
} }
} }

View File

@@ -49,7 +49,7 @@ class UIQuickslotPie : UICanvas() {
// update controls // update controls
if (handler.isOpened || handler.isOpening) { if (handler.isOpened || handler.isOpening) {
val cursorPos = Vector2(Terrarum.mouseScreenX.toDouble(), Terrarum.mouseScreenY.toDouble()) val cursorPos = Vector2(Terrarum.mouseScreenX.toDouble(), Terrarum.mouseScreenY.toDouble())
val centre = Vector2(Toolkit.drawWidth / 2.0, App.scr.halfh.toDouble()) val centre = Vector2(Toolkit.hdrawWidth.toDouble(), App.scr.halfh.toDouble())
val deg = -(centre - cursorPos).direction.toFloat() val deg = -(centre - cursorPos).direction.toFloat()
selection = Math.round(deg * slotCount / FastMath.TWO_PI) selection = Math.round(deg * slotCount / FastMath.TWO_PI)

View File

@@ -8,6 +8,7 @@ import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.gameitems.GameItem import net.torvald.terrarum.gameitems.GameItem
import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.getWidthOfCells
import net.torvald.terrarum.ui.Toolkit import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas import net.torvald.terrarum.ui.UICanvas
import net.torvald.unicode.getKeycapPC import net.torvald.unicode.getKeycapPC
@@ -23,7 +24,7 @@ internal class UIStorageChest : UICanvas(
lateinit var chestInventory: FixtureInventory lateinit var chestInventory: FixtureInventory
lateinit var chestNameFun: () -> String lateinit var chestNameFun: () -> String
override var width = App.scr.width override var width = Toolkit.drawWidth
override var height = App.scr.height override var height = App.scr.height
private val negotiator = object : InventoryTransactionNegotiator() { private val negotiator = object : InventoryTransactionNegotiator() {
@@ -49,12 +50,12 @@ internal class UIStorageChest : UICanvas(
private var encumbrancePerc = 0f private var encumbrancePerc = 0f
private var isEncumbered = false private var isEncumbered = false
private var halfSlotOffset = (UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap) / 2 private var halfSlotOffset = (UIItemInventoryElemSimple.height + UIItemInventoryItemGrid.listGap * 2) / 2
init { init {
catBar = UIItemInventoryCatBar( catBar = UIItemInventoryCatBar(
this, this,
(App.scr.width - UIInventoryFull.catBarWidth) / 2, (width - UIInventoryFull.catBarWidth) / 2,
42 - UIInventoryFull.YPOS_CORRECTION + (App.scr.height - UIInventoryFull.internalHeight) / 2, 42 - UIInventoryFull.YPOS_CORRECTION + (App.scr.height - UIInventoryFull.internalHeight) / 2,
UIInventoryFull.internalWidth, UIInventoryFull.internalWidth,
UIInventoryFull.catBarWidth, UIInventoryFull.catBarWidth,
@@ -65,17 +66,19 @@ internal class UIStorageChest : UICanvas(
this, this,
catBar, catBar,
{ getFixtureInventory() }, { getFixtureInventory() },
UIInventoryFull.INVENTORY_CELLS_OFFSET_X() - halfSlotOffset, Toolkit.hdrawWidth - getWidthOfCells(6) - halfSlotOffset,
UIInventoryFull.INVENTORY_CELLS_OFFSET_Y(), UIInventoryFull.INVENTORY_CELLS_OFFSET_Y(),
6, UIInventoryFull.CELLS_VRT, 6, UIInventoryFull.CELLS_VRT,
drawScrollOnRightside = false, drawScrollOnRightside = false,
drawWallet = false, drawWallet = false,
keyDownFun = { _, _, _, _, _ -> Unit }, keyDownFun = { _, _, _, _, _ -> Unit },
touchDownFun = { gameItem, amount, _, _, _ -> touchDownFun = { gameItem, amount, button, _, _ ->
if (gameItem != null) { if (button == App.getConfigInt("config_mouseprimary")) {
negotiator.reject(getFixtureInventory(), getPlayerInventory(), gameItem, amount) if (gameItem != null) {
negotiator.reject(getFixtureInventory(), getPlayerInventory(), gameItem, amount)
}
itemListUpdate()
} }
itemListUpdate()
} }
) )
// make grid mode buttons work together // make grid mode buttons work together
@@ -86,17 +89,19 @@ internal class UIStorageChest : UICanvas(
this, this,
catBar, catBar,
{ INGAME.actorNowPlaying!!.inventory }, // literally a player's inventory { INGAME.actorNowPlaying!!.inventory }, // literally a player's inventory
UIInventoryFull.INVENTORY_CELLS_OFFSET_X() - halfSlotOffset + (UIItemInventoryItemGrid.listGap + UIItemInventoryElemWide.height) * 7, Toolkit.hdrawWidth + halfSlotOffset,
UIInventoryFull.INVENTORY_CELLS_OFFSET_Y(), UIInventoryFull.INVENTORY_CELLS_OFFSET_Y(),
6, UIInventoryFull.CELLS_VRT, 6, UIInventoryFull.CELLS_VRT,
drawScrollOnRightside = true, drawScrollOnRightside = true,
drawWallet = false, drawWallet = false,
keyDownFun = { _, _, _, _, _ -> Unit }, keyDownFun = { _, _, _, _, _ -> Unit },
touchDownFun = { gameItem, amount, _, _, _ -> touchDownFun = { gameItem, amount, button, _, _ ->
if (gameItem != null) { if (button == App.getConfigInt("config_mouseprimary")) {
negotiator.accept(getPlayerInventory(), getFixtureInventory(), gameItem, amount) if (gameItem != null) {
negotiator.accept(getPlayerInventory(), getFixtureInventory(), gameItem, amount)
}
itemListUpdate()
} }
itemListUpdate()
} }
) )
itemListPlayer.navRemoCon.listButtonListener = { _,_ -> setCompact(false) } itemListPlayer.navRemoCon.listButtonListener = { _,_ -> setCompact(false) }
@@ -161,7 +166,7 @@ internal class UIStorageChest : UICanvas(
if (openingClickLatched && !Terrarum.mouseDown) openingClickLatched = false if (openingClickLatched && !Terrarum.mouseDown) openingClickLatched = false
} }
private val thisOffsetX = UIInventoryFull.INVENTORY_CELLS_OFFSET_X() - halfSlotOffset private val thisOffsetX = Toolkit.hdrawWidth - getWidthOfCells(6) - halfSlotOffset
private val thisOffsetX2 = thisOffsetX + (UIItemInventoryItemGrid.listGap + UIItemInventoryElemWide.height) * 7 private val thisOffsetX2 = thisOffsetX + (UIItemInventoryItemGrid.listGap + UIItemInventoryElemWide.height) * 7
private val thisOffsetY = UIInventoryFull.INVENTORY_CELLS_OFFSET_Y() private val thisOffsetY = UIInventoryFull.INVENTORY_CELLS_OFFSET_Y()
private val cellsWidth = (UIItemInventoryItemGrid.listGap + UIItemInventoryElemWide.height) * 6 - UIItemInventoryItemGrid.listGap private val cellsWidth = (UIItemInventoryItemGrid.listGap + UIItemInventoryElemWide.height) * 6 - UIItemInventoryItemGrid.listGap

View File

@@ -3,8 +3,8 @@ package net.torvald.terrarum.modulebasegame.ui
import com.badlogic.gdx.graphics.Camera import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.jme3.math.FastMath
import net.torvald.terrarum.* import net.torvald.terrarum.*
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.INVENTORY_CELLS_OFFSET_Y
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.YPOS_CORRECTION import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.YPOS_CORRECTION
@@ -13,7 +13,6 @@ import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.internal
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.internalWidth import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.internalWidth
import net.torvald.terrarum.ui.* import net.torvald.terrarum.ui.*
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import net.torvald.unicode.getKeycapConsole
import net.torvald.unicode.getKeycapPC import net.torvald.unicode.getKeycapPC
/** /**
@@ -53,7 +52,9 @@ class UIWorldPortal : UICanvas(
this, this,
0, 0,
42 - YPOS_CORRECTION + (App.scr.height - internalHeight) / 2, 42 - YPOS_CORRECTION + (App.scr.height - internalHeight) / 2,
) { i -> if (!panelTransitionLocked) requestTransition(i) } ) { i ->
if (!panelTransitionLocked) requestTransition(i ushr 1)
}
private val SP = "\u3000 " private val SP = "\u3000 "
@@ -83,7 +84,9 @@ class UIWorldPortal : UICanvas(
addUIitem(catBar) addUIitem(catBar)
addUIitem(transitionPanel) addUIitem(transitionPanel)
catBar.selectionChangeListener = { old, new ->
}
} }
@@ -96,7 +99,8 @@ class UIWorldPortal : UICanvas(
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
catBar.update(delta)
transitionPanel.update(delta)
} }
override fun renderUI(batch: SpriteBatch, camera: Camera) { override fun renderUI(batch: SpriteBatch, camera: Camera) {
@@ -113,8 +117,13 @@ class UIWorldPortal : UICanvas(
INGAME.setTooltipMessage(null) INGAME.setTooltipMessage(null)
} }
override fun hide() {
transitionPanel.hide()
}
override fun dispose() { override fun dispose() {
catBar.dispose() catBar.dispose()
transitionPanel.dispose()
} }
fun resetUI() { fun resetUI() {
@@ -124,18 +133,21 @@ class UIWorldPortal : UICanvas(
override fun doOpening(delta: Float) { override fun doOpening(delta: Float) {
super.doOpening(delta) super.doOpening(delta)
resetUI() resetUI()
transitionPanel.uis.forEach { it.opacity = FastMath.pow(opacity, 0.5f) }
INGAME.pause() INGAME.pause()
INGAME.setTooltipMessage(null) INGAME.setTooltipMessage(null)
} }
override fun doClosing(delta: Float) { override fun doClosing(delta: Float) {
super.doClosing(delta) super.doClosing(delta)
transitionPanel.uis.forEach { it.opacity = FastMath.pow(opacity, 0.5f) }
INGAME.resume() INGAME.resume()
INGAME.setTooltipMessage(null) INGAME.setTooltipMessage(null)
} }
override fun endOpening(delta: Float) { override fun endOpening(delta: Float) {
super.endOpening(delta) super.endOpening(delta)
transitionPanel.uis.forEach { it.opacity = FastMath.pow(opacity, 0.5f) }
UIItemInventoryItemGrid.tooltipShowing.clear() UIItemInventoryItemGrid.tooltipShowing.clear()
INGAME.setTooltipMessage(null) // required! INGAME.setTooltipMessage(null) // required!
} }
@@ -143,6 +155,7 @@ class UIWorldPortal : UICanvas(
override fun endClosing(delta: Float) { override fun endClosing(delta: Float) {
super.endClosing(delta) super.endClosing(delta)
resetUI() resetUI()
transitionPanel.uis.forEach { it.opacity = FastMath.pow(opacity, 0.5f) }
UIItemInventoryItemGrid.tooltipShowing.clear() UIItemInventoryItemGrid.tooltipShowing.clear()
INGAME.setTooltipMessage(null) // required! INGAME.setTooltipMessage(null) // required!
} }
@@ -179,13 +192,19 @@ class UIItemWorldPortalTopBar(
"CONTEXT_WORLD_SEARCH", "CONTEXT_WORLD_SEARCH",
"", "",
"CONTEXT_WORLD_LIST", "CONTEXT_WORLD_LIST",
"GAME_INVENTORY",
"", "",
"GAME_INVENTORY",
) )
private val buttonGapSize = 120 private val buttonGapSize = 120
private val highlighterYPos = icons.tileH + 4 private val highlighterYPos = icons.tileH + 4
var selection = 2 var selectedPanel = 2; private set
/** (oldIndex: Int?, newIndex: Int) -> Unit
* Indices are raw index. That is, not re-arranged. */
var selectionChangeListener: ((Int?, Int) -> Unit)? = null
private var transitionFired = false
private val buttons = Array<UIItemImageButton>(5) { private val buttons = Array<UIItemImageButton>(5) {
val xoff = if (it == 1) -32 else if (it == 3) 32 else 0 val xoff = if (it == 1) -32 else if (it == 3) 32 else 0
@@ -204,6 +223,30 @@ class UIItemWorldPortalTopBar(
) )
} }
private val workingButtons = arrayOf(0,2,4)
override fun update(delta: Float) {
super.update(delta)
workingButtons.forEach { buttons[it].update(delta) }
// transition stuffs
workingButtons.filter { buttons[it].mousePushed }.firstOrNull()?.let { pushedButton ->
if (selectedPanel != pushedButton) transitionFired = true
selectedPanel = pushedButton
workingButtons.forEach { i ->
buttons[i].highlighted = i == pushedButton
}
}
if (transitionFired) {
transitionFired = false
panelTransitionReqFun(selectedPanel)
}
}
override fun render(batch: SpriteBatch, camera: Camera) { override fun render(batch: SpriteBatch, camera: Camera) {
super.render(batch, camera) super.render(batch, camera)
@@ -212,8 +255,8 @@ class UIItemWorldPortalTopBar(
// label // label
batch.color = Color.WHITE batch.color = Color.WHITE
val text = Lang[catIconLabels[selection]] val text = Lang[catIconLabels[selectedPanel]]
App.fontGame.draw(batch, text, buttons[selection].posX + 10 - (App.fontGame.getWidth(text) / 2), posY + highlighterYPos + 4) App.fontGame.draw(batch, text, buttons[selectedPanel].posX + 10 - (App.fontGame.getWidth(text) / 2), posY + highlighterYPos + 4)
blendNormalStraightAlpha(batch) blendNormalStraightAlpha(batch)

View File

@@ -12,14 +12,11 @@ class UIWorldPortalCargo(val full: UIWorldPortal) : UICanvas() {
override var height: Int = App.scr.height override var height: Int = App.scr.height
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
TODO("Not yet implemented")
} }
override fun renderUI(batch: SpriteBatch, camera: Camera) { override fun renderUI(batch: SpriteBatch, camera: Camera) {
TODO("Not yet implemented")
} }
override fun dispose() { override fun dispose() {
TODO("Not yet implemented")
} }
} }

View File

@@ -259,7 +259,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
uiItems.forEach { it.update(delta) } uiItems.forEach { it.update(delta) }
worldCells.forEach { it.update(delta) } if (::worldCells.isInitialized) worldCells.forEach { it.update(delta) }
} }
private val iconGap = 12f private val iconGap = 12f
@@ -350,7 +350,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
uiItems.forEach { it.render(batch, camera) } uiItems.forEach { it.render(batch, camera) }
worldCells.forEach { it.render(batch, camera) } if (::worldCells.isInitialized) worldCells.forEach { it.render(batch, camera) }
// control hints // control hints
batch.color = Color.WHITE batch.color = Color.WHITE
@@ -359,15 +359,15 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
override fun hide() { override fun hide() {
uiItems.forEach { it.hide() } uiItems.forEach { it.hide() }
worldCells.forEach { it.hide() } if (::worldCells.isInitialized) worldCells.forEach { it.hide() }
worldCells.forEach { try { it.dispose() } catch (_: GdxRuntimeException) {} } if (::worldCells.isInitialized) worldCells.forEach { try { it.dispose() } catch (_: GdxRuntimeException) {} }
worldList.forEach { try { it.dispose() } catch (_: GdxRuntimeException) {} } worldList.forEach { try { it.dispose() } catch (_: GdxRuntimeException) {} }
} }
override fun dispose() { override fun dispose() {
uiItems.forEach { it.dispose() } uiItems.forEach { it.dispose() }
worldCells.forEach { try { it.dispose() } catch (_: GdxRuntimeException) {} } if (::worldCells.isInitialized) worldCells.forEach { try { it.dispose() } catch (_: GdxRuntimeException) {} }
worldList.forEach { try { it.dispose() } catch (_: GdxRuntimeException) {} } worldList.forEach { try { it.dispose() } catch (_: GdxRuntimeException) {} }
} }
@@ -384,7 +384,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
if (this.isVisible) { if (this.isVisible) {
uiItems.forEach { it.touchUp(screenX, screenY, pointer, button) } uiItems.forEach { it.touchUp(screenX, screenY, pointer, button) }
worldCells.forEach { it.touchUp(screenX, screenY, pointer, button) } if (::worldCells.isInitialized) worldCells.forEach { it.touchUp(screenX, screenY, pointer, button) }
handler.subUIs.forEach { it.touchUp(screenX, screenY, pointer, button) } handler.subUIs.forEach { it.touchUp(screenX, screenY, pointer, button) }
return true return true
} }
@@ -394,7 +394,7 @@ class UIWorldPortalListing(val full: UIWorldPortal) : UICanvas() {
override fun scrolled(amountX: Float, amountY: Float): Boolean { override fun scrolled(amountX: Float, amountY: Float): Boolean {
if (this.isVisible) { if (this.isVisible) {
uiItems.forEach { it.scrolled(amountX, amountY) } uiItems.forEach { it.scrolled(amountX, amountY) }
worldCells.forEach { it.scrolled(amountX, amountY) } if (::worldCells.isInitialized) worldCells.forEach { it.scrolled(amountX, amountY) }
handler.subUIs.forEach { it.scrolled(amountX, amountY) } handler.subUIs.forEach { it.scrolled(amountX, amountY) }
return true return true
} }

View File

@@ -15,14 +15,11 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
override var height: Int = App.scr.height override var height: Int = App.scr.height
override fun updateUI(delta: Float) { override fun updateUI(delta: Float) {
TODO("Not yet implemented")
} }
override fun renderUI(batch: SpriteBatch, camera: Camera) { override fun renderUI(batch: SpriteBatch, camera: Camera) {
TODO("Not yet implemented")
} }
override fun dispose() { override fun dispose() {
TODO("Not yet implemented")
} }
} }

View File

@@ -93,6 +93,10 @@ object Toolkit : Disposable {
get() = App.scr.width - if (App.getConfigBoolean("fx_streamerslayout")) App.scr.chatWidth else 0 get() = App.scr.width - if (App.getConfigBoolean("fx_streamerslayout")) App.scr.chatWidth else 0
val drawWidthf: Float val drawWidthf: Float
get() = drawWidth.toFloat() get() = drawWidth.toFloat()
val hdrawWidth: Int
get() = drawWidth / 2
val hdrawWidthf: Float
get() = hdrawWidth.toFloat()
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