diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
index 77fa1251f..446f81346 100644
--- a/.idea/codeStyleSettings.xml
+++ b/.idea/codeStyleSettings.xml
@@ -33,6 +33,8 @@
+
+
diff --git a/assets/graphics/fonts/terrarum-sans-bitmap/ascii_variable.tga b/assets/graphics/fonts/terrarum-sans-bitmap/ascii_variable.tga
index 508aebd5f..cb0fc1aa9 100644
--- a/assets/graphics/fonts/terrarum-sans-bitmap/ascii_variable.tga
+++ b/assets/graphics/fonts/terrarum-sans-bitmap/ascii_variable.tga
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:e223c3b159be360272b57a976198133bcf985957c16e00f2e2d910bf8dee4b0f
+oid sha256:ea628ce55158bd3e650b36f0be6ed6d935881930302e036007608f9c85ec977e
size 327724
diff --git a/src/net/torvald/terrarum/Ingame.kt b/src/net/torvald/terrarum/Ingame.kt
index 02db095cf..bc20c7bca 100644
--- a/src/net/torvald/terrarum/Ingame.kt
+++ b/src/net/torvald/terrarum/Ingame.kt
@@ -312,16 +312,20 @@ class Ingame(val batch: SpriteBatch) : Screen {
// >- queue up game UIs that should pause the world -<
// inventory
- uiInventoryPlayer = UIInventory(player,
+ /*uiInventoryPlayer = UIInventory(player,
width = 900,
height = Terrarum.HEIGHT - 160,
categoryWidth = 210,
toggleKeyLiteral = Terrarum.getConfigInt("keyinventory")
- )
- uiInventoryPlayer.setPosition(
+ )*/
+ /*uiInventoryPlayer.setPosition(
-uiInventoryPlayer.width,
70
+ )*/
+ uiInventoryPlayer = UIInventoryFull(player,
+ toggleKeyLiteral = Terrarum.getConfigInt("keyinventory")
)
+ uiInventoryPlayer.setPosition(0, 0)
// >- lesser UIs -<
// quick bar
@@ -904,7 +908,12 @@ class Ingame(val batch: SpriteBatch) : Screen {
// draw some overlays (UI) //
/////////////////////////////
- uiContainer.forEach { if (it != consoleHandler) it.render(batch, camera) }
+ uiContainer.forEach {
+ if (it != consoleHandler) {
+ batch.color = Color.WHITE
+ it.render(batch, camera)
+ }
+ }
debugWindow.render(batch, camera)
// make sure console draws on top of other UIs
@@ -1447,12 +1456,12 @@ class Ingame(val batch: SpriteBatch) : Screen {
(Terrarum.WIDTH - notifier.width) / 2, Terrarum.HEIGHT - notifier.height)
// inventory
- uiInventoryPlayer =
+ /*uiInventoryPlayer =
UIInventory(player,
width = 840,
height = Terrarum.HEIGHT - 160,
categoryWidth = 210
- )
+ )*/
// basic watch-style notification bar (temperature, new mail)
diff --git a/src/net/torvald/terrarum/UIItemInventoryCatBar.kt b/src/net/torvald/terrarum/UIItemInventoryCatBar.kt
new file mode 100644
index 000000000..d06bcb819
--- /dev/null
+++ b/src/net/torvald/terrarum/UIItemInventoryCatBar.kt
@@ -0,0 +1,157 @@
+package net.torvald.terrarum
+
+import com.badlogic.gdx.graphics.Camera
+import com.badlogic.gdx.graphics.Color
+import com.badlogic.gdx.graphics.Pixmap
+import com.badlogic.gdx.graphics.Texture
+import com.badlogic.gdx.graphics.g2d.SpriteBatch
+import net.torvald.terrarum.gameactors.Second
+import net.torvald.terrarum.gameactors.floorInt
+import net.torvald.terrarum.gameactors.roundInt
+import net.torvald.terrarum.ui.*
+import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
+
+/**
+ * Created by minjaesong on 2017-10-20.
+ */
+class UIItemInventoryCatBar(
+ parentUI: UICanvas,
+ override var posX: Int,
+ override var posY: Int,
+ override val width: Int,
+ val catIcons: TextureRegionPack = TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20),
+ val catArrangement: IntArray = intArrayOf(9,6,7,1,0,2,3,4,5,8)
+) : UIItem(parentUI) {
+
+ private val inventoryUI = parentUI
+ override val height = catIcons.tileH + 5
+
+
+ private val buttons: Array
+ private val buttonGapSize = (width.toFloat() - (catArrangement.size * catIcons.tileW)) / (catArrangement.size + 1f)
+ var selectedIndex = 0 // default to ALL
+ private set
+ val selectedIcon: Int
+ get() = catArrangement[selectedIndex]
+ private val catSelectionOld = 0 // default to ALL
+
+ // set up buttons
+ init {
+ // place sub UIs: Image Buttons
+ buttons = Array(catArrangement.size, { index ->
+ val iconPosX = (buttonGapSize + catIcons.tileW).roundInt()
+ val iconPosY = 0
+
+ UIItemImageButton(
+ inventoryUI,
+ catIcons.get(catArrangement[index], 0),
+ activeBackCol = Color(0),
+ activeBackBlendMode = BlendMode.NORMAL,
+ posX = posX + iconPosX,
+ posY = posY + iconPosY,
+ highlightable = true
+ )
+ })
+ }
+
+
+ private val underlineIndTex: Texture
+ private val underlineColour = Color(0xeaeaea_40.toInt())
+ private val underlineHighlightColour = buttons[0].highlightCol
+ private var highlighterXStart = 0.0 // left-end position
+ private var highlighterXEnd = 0.0 // left-end position
+ private var highlighterXPos = 0.0 // left-end position
+ private val highlighterYPos = catIcons.tileH + 5f
+ private var highlighterMoving = false
+ private val highlighterMoveDuration: Second = 0.1f
+ private var highlighterMoveTimer: Second = 0f
+
+ // set up underlined indicator
+ init {
+ // procedurally generate texture
+ val pixmap = Pixmap(catIcons.tileW + buttonGapSize.floorInt(), 1, Pixmap.Format.RGBA8888)
+ for (x in 0 until pixmap.width.plus(1).ushr(1)) { // eqv. of ceiling the half-int
+ val col = if (x == 0) 0xffffff_80.toInt()
+ else if (x == 1) 0xffffff_c0.toInt()
+ else 0xffffff_ff.toInt()
+
+ pixmap.drawPixel(x, 0, col)
+ pixmap.drawPixel(pixmap.width - (x + 1), 0, col)
+ }
+ underlineIndTex = Texture(pixmap)
+ underlineIndTex.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
+ pixmap.dispose() // FIXME is this how it's supposed to work? (still a noob)
+ }
+
+
+ /** (oldIndex: Int?, newIndex: Int) -> Unit */
+ var selectionChangeListener: ((Int?, Int) -> Unit)? = null
+
+ override fun update(delta: Float) {
+ super.update(delta)
+
+
+ if (highlighterMoving) {
+ highlighterMoveTimer += delta
+
+ if (selectedIndex != null) {
+ highlighterXPos = UIUtils.moveQuick(
+ highlighterXStart,
+ highlighterXEnd,
+ highlighterMoveTimer.toDouble(),
+ highlighterMoveDuration.toDouble()
+ )
+ }
+
+ if (highlighterMoveTimer > highlighterMoveDuration) {
+ highlighterMoveTimer = 0f
+ highlighterXStart = highlighterXEnd
+ highlighterXPos = highlighterXEnd
+ highlighterMoving = false
+ }
+ }
+
+
+ buttons.forEachIndexed { index, btn ->
+ btn.update(delta)
+
+
+ if (btn.mousePushed && index != selectedIndex) {
+ val oldIndex = selectedIndex
+
+ highlighterXStart = buttons[selectedIndex].posY.toDouble()
+ selectedIndex = index
+ highlighterMoving = true
+ highlighterXEnd = buttons[selectedIndex].posY.toDouble()
+
+ selectionChangeListener?.invoke(oldIndex, index)
+ }
+ btn.highlighted = (index == selectedIndex) // forcibly highlight if this.highlighted != null
+
+ }
+ }
+
+ override fun render(batch: SpriteBatch, camera: Camera) {
+ super.render(batch, camera)
+
+ // button
+ // colour determined by UI items themselves
+ buttons.forEach { it.render(batch, camera) }
+
+ // underline
+ batch.color = underlineColour
+ batch.drawStraightLine(posX.toFloat(), posY + height - 1f, width.toFloat(), 1f, false)
+
+ // indicator
+ batch.color = underlineHighlightColour
+ batch.draw(underlineIndTex, (posX + highlighterXPos).toFloat().round(), posY + highlighterYPos)
+ }
+
+
+
+
+ override fun dispose() {
+ underlineIndTex.dispose()
+ catIcons.dispose()
+ }
+}
\ No newline at end of file
diff --git a/src/net/torvald/terrarum/UIItemInventoryElem.kt b/src/net/torvald/terrarum/UIItemInventoryElem.kt
index 381727461..d3c716aef 100644
--- a/src/net/torvald/terrarum/UIItemInventoryElem.kt
+++ b/src/net/torvald/terrarum/UIItemInventoryElem.kt
@@ -1,14 +1,13 @@
package net.torvald.terrarum
import com.badlogic.gdx.Input
+import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
import net.torvald.colourutil.CIELabUtil.darkerLab
import net.torvald.terrarum.itemproperties.GameItem
-import net.torvald.terrarum.ui.UIInventory
-import net.torvald.terrarum.ui.UIItem
-import net.torvald.terrarum.ui.UIItemTextButton
+import net.torvald.terrarum.ui.*
/***
* Note that the UI will not render if either item or itemImage is null.
@@ -16,27 +15,31 @@ import net.torvald.terrarum.ui.UIItemTextButton
* Created by minjaesong on 2017-03-16.
*/
class UIItemInventoryElem(
- parentUI: UIInventory,
+ parentUI: UIInventoryFull,
override var posX: Int,
override var posY: Int,
override val width: Int,
- var item: GameItem?,
- var amount: Int,
- var itemImage: TextureRegion?,
+ override var item: GameItem?,
+ override var amount: Int,
+ override var itemImage: TextureRegion?,
val mouseOverTextCol: Color = Color(0xfff066_ff.toInt()),
val mouseoverBackCol: Color = Color(0),
val mouseoverBackBlendMode: String = BlendMode.NORMAL,
val inactiveTextCol: Color = UIItemTextButton.defaultInactiveCol,
val backCol: Color = Color(0),
val backBlendMode: String = BlendMode.NORMAL,
- var quickslot: Int? = null,
- var equippedSlot: Int? = null,
+ override var quickslot: Int? = null,
+ override var equippedSlot: Int? = null,
val drawBackOnNull: Boolean = true
-) : UIItem(parentUI) {
+) : UIItemInventoryCellBase(parentUI, posX, posY, item, amount, itemImage, quickslot, equippedSlot) {
companion object {
val height = 48
val UNIQUE_ITEM_HAS_NO_AMOUNT = -1
+
+ internal val durabilityCol = Color(0x22ff11_ff)
+ internal val durabilityBack: Color; get() = durabilityCol.darkerLab(0.4f)
+ internal val durabilityBarThickness = 3f
}
private val inventoryUI = parentUI
@@ -49,8 +52,7 @@ class UIItemInventoryElem(
private val textOffsetY = 8f
- private val durabilityCol = Color(0x22ff11_ff)
- private val durabilityBack: Color; get() = durabilityCol.darkerLab(0.4f)
+
private val durabilityBarOffY = 35f
@@ -63,7 +65,7 @@ class UIItemInventoryElem(
private val fwsp = 0x3000.toChar()
- override fun render(batch: SpriteBatch) {
+ override fun render(batch: SpriteBatch, camera: Camera) {
// mouseover background
if (item != null || drawBackOnNull) {
@@ -91,6 +93,7 @@ class UIItemInventoryElem(
// if mouse is over, text lights up
// this one-liner sets color
batch.color = item!!.nameColour mul if (mouseUp) mouseOverTextCol else inactiveTextCol
+ // draw name of the item
Terrarum.fontGame.draw(batch,
//"$item" + (if (amount > 0 && item!!.stackable) "$fwsp($amount)" else if (amount != 1) "$fwsp!!$amount!!" else "") +
item!!.name + (if (amount > 0 && item!!.stackable) "$fwsp($amount)" else if (amount != 1) "$fwsp!!$amount!!" else "") +
@@ -105,9 +108,9 @@ class UIItemInventoryElem(
val barOffset = posX + textOffsetX
if (item!!.maxDurability > 0.0) {
batch.color = durabilityBack
- batch.drawStraightLine(barOffset, posY + durabilityBarOffY, barOffset + barFullLen, 3f, false)
+ batch.drawStraightLine(barOffset, posY + durabilityBarOffY, barOffset + barFullLen, durabilityBarThickness, false)
batch.color = durabilityCol
- batch.drawStraightLine(barOffset, posY + durabilityBarOffY, barOffset + barFullLen * (item!!.durability / item!!.maxDurability), 3f, false)
+ batch.drawStraightLine(barOffset, posY + durabilityBarOffY, barOffset + barFullLen * (item!!.durability / item!!.maxDurability), durabilityBarThickness, false)
}
@@ -134,7 +137,7 @@ class UIItemInventoryElem(
val currentSlotItem = inventory?.getQuickBar(slot)
- inventory?.setQuickBar(
+ inventory.setQuickBar(
slot,
if (currentSlotItem?.item != item)
item?.dynamicID // register
@@ -145,8 +148,8 @@ class UIItemInventoryElem(
// search for duplicates in the quickbar, except mine
// if there is, unregister the other
(0..9).minus(slot).forEach {
- if (inventory?.getQuickBar(it)?.item == item) {
- inventory?.setQuickBar(it, null)
+ if (inventory.getQuickBar(it)?.item == item) {
+ inventory.setQuickBar(it, null)
}
}
}
@@ -161,7 +164,7 @@ class UIItemInventoryElem(
val itemEquipSlot = item!!.equipPosition
val player = Terrarum.ingame!!.player
- if (item != player.inventory?.itemEquipped?.get(itemEquipSlot)) { // if this item is unequipped, equip it
+ if (item != player.inventory.itemEquipped.get(itemEquipSlot)) { // if this item is unequipped, equip it
player.equipItem(item!!)
}
else { // if not, unequip it
diff --git a/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt b/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt
new file mode 100644
index 000000000..6bdccb193
--- /dev/null
+++ b/src/net/torvald/terrarum/UIItemInventoryElemSimple.kt
@@ -0,0 +1,184 @@
+package net.torvald.terrarum
+
+import com.badlogic.gdx.Input
+import com.badlogic.gdx.graphics.Camera
+import com.badlogic.gdx.graphics.Color
+import com.badlogic.gdx.graphics.g2d.SpriteBatch
+import com.badlogic.gdx.graphics.g2d.TextureRegion
+import net.torvald.terrarum.itemproperties.GameItem
+import net.torvald.terrarum.ui.*
+
+/**
+ * Created by minjaesong on 2017-10-20.
+ */
+class UIItemInventoryElemSimple(
+ parentUI: UIInventoryFull,
+ override var posX: Int,
+ override var posY: Int,
+ override var item: GameItem?,
+ override var amount: Int,
+ override var itemImage: TextureRegion?,
+ val mouseOverTextCol: Color = Color(0xfff066_ff.toInt()),
+ val mouseoverBackCol: Color = Color(0),
+ val mouseoverBackBlendMode: String = BlendMode.NORMAL,
+ val inactiveTextCol: Color = UIItemTextButton.defaultInactiveCol,
+ val backCol: Color = Color(0),
+ val backBlendMode: String = BlendMode.NORMAL,
+ override var quickslot: Int? = null,
+ override var equippedSlot: Int? = null,
+ val drawBackOnNull: Boolean = true
+) : UIItemInventoryCellBase(parentUI, posX, posY, item, amount, itemImage, quickslot, equippedSlot) {
+
+ companion object {
+ val height = UIItemInventoryElem.height
+ }
+
+ private val inventoryUI = parentUI
+
+ override val width = UIItemInventoryElemSimple.height
+ override val height = UIItemInventoryElemSimple.height
+
+ private val imgOffset: Float
+ get() = (this.height - itemImage!!.regionHeight).div(2).toFloat() // to snap to the pixel grid
+
+ override fun update(delta: Float) {
+ if (item != null) {
+
+ }
+ }
+
+ override fun render(batch: SpriteBatch, camera: Camera) {
+ // mouseover background
+ if (item != null || drawBackOnNull) {
+ // do not highlight even if drawBackOnNull is true
+ if (mouseUp && item != null) {
+ BlendMode.resolve(mouseoverBackBlendMode)
+ batch.color = mouseoverBackCol
+ }
+ // if drawBackOnNull, just draw background
+ else {
+ BlendMode.resolve(backBlendMode)
+ batch.color = backCol
+ }
+ batch.fillRect(posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
+ }
+
+
+ // quickslot and equipped slot indicator is not needed as it's intended for blocks and walls
+ // and you can clearly see the quickslot UI anyway
+
+ if (item != null && itemImage != null) {
+ blendNormal()
+
+ // item image
+ batch.color = Color.WHITE
+ batch.draw(itemImage, posX + imgOffset, posY + imgOffset)
+
+ // if mouse is over, text lights up
+ // this one-liner sets color
+ batch.color = item!!.nameColour mul if (mouseUp) mouseOverTextCol else inactiveTextCol
+
+
+ // if item has durability, draw that and don't draw count; durability and itemCount cannot coexist
+ if (item!!.maxDurability > 0.0) {
+ // draw durability metre
+ val barFullLen = width
+ val barOffset = posX.toFloat()
+ val thickness = UIItemInventoryElem.durabilityBarThickness
+ if (item!!.maxDurability > 0.0) {
+ batch.color = UIItemInventoryElem.durabilityBack
+ batch.drawStraightLine(barOffset, posY + height - thickness, barOffset + barFullLen, thickness, false)
+ batch.color = UIItemInventoryElem.durabilityCol
+ batch.drawStraightLine(barOffset, posY + height - thickness, barOffset + barFullLen * (item!!.durability / item!!.maxDurability), thickness, false)
+ }
+ }
+ else {
+ // draw item count
+ val amountString = amount.toString()
+ Terrarum.fontSmallNumbers.draw(batch,
+ amountString,
+ posX + (width - Terrarum.fontSmallNumbers.getWidth(amountString)).toFloat(),
+ posY + (height - Terrarum.fontSmallNumbers.H).toFloat()
+ )
+ }
+
+ }
+
+ // see IFs above?
+ batch.color = Color.WHITE
+
+ }
+
+ override fun keyDown(keycode: Int): Boolean {
+ if (item != null && Terrarum.ingame != null && keycode in Input.Keys.NUM_1..Input.Keys.NUM_0) {
+ val inventory = Terrarum.ingame!!.player.inventory
+ val slot = if (keycode == Input.Keys.NUM_0) 9 else keycode - Input.Keys.NUM_1
+ val currentSlotItem = inventory?.getQuickBar(slot)
+
+
+ inventory.setQuickBar(
+ slot,
+ if (currentSlotItem?.item != item)
+ item?.dynamicID // register
+ else
+ null // drop registration
+ )
+
+ // search for duplicates in the quickbar, except mine
+ // if there is, unregister the other
+ (0..9).minus(slot).forEach {
+ if (inventory.getQuickBar(it)?.item == item) {
+ inventory.setQuickBar(it, null)
+ }
+ }
+ }
+
+ return true
+ }
+
+ override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
+ if (item != null && Terrarum.ingame != null) {
+
+ // equip da shit
+ val itemEquipSlot = item!!.equipPosition
+ val player = Terrarum.ingame!!.player
+
+ if (item != player.inventory.itemEquipped.get(itemEquipSlot)) { // if this item is unequipped, equip it
+ player.equipItem(item!!)
+ }
+ else { // if not, unequip it
+ player.unequipItem(item!!)
+ }
+ }
+
+ inventoryUI.rebuildList()
+
+ return true
+ }
+
+
+ override fun dispose() {
+ itemImage?.texture?.dispose()
+ }
+
+ override fun keyUp(keycode: Int): Boolean {
+ return super.keyUp(keycode)
+ }
+
+ override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
+ return super.mouseMoved(screenX, screenY)
+ }
+
+ override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
+ return super.touchDragged(screenX, screenY, pointer)
+ }
+
+ override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
+ return super.touchUp(screenX, screenY, pointer, button)
+ }
+
+ override fun scrolled(amount: Int): Boolean {
+ return super.scrolled(amount)
+ }
+
+}
\ No newline at end of file
diff --git a/src/net/torvald/terrarum/gameactors/ActorHumanoid.kt b/src/net/torvald/terrarum/gameactors/ActorHumanoid.kt
index b2c044bde..da887bb2f 100644
--- a/src/net/torvald/terrarum/gameactors/ActorHumanoid.kt
+++ b/src/net/torvald/terrarum/gameactors/ActorHumanoid.kt
@@ -9,7 +9,7 @@ import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.itemproperties.GameItem
import net.torvald.terrarum.itemproperties.Material
import net.torvald.terrarum.realestate.LandUtil
-import net.torvald.terrarum.ui.UIInventory
+import net.torvald.terrarum.ui.UIInventoryFull
import net.torvald.terrarum.worlddrawer.LightmapRenderer
import java.util.*
@@ -530,7 +530,7 @@ open class ActorHumanoid(
// force update inventory UI
try {
- (Terrarum.ingame!!.uiInventoryPlayer as UIInventory).shutUpAndRebuild()
+ (Terrarum.ingame!!.uiInventoryPlayer as UIInventoryFull).rebuildList()
}
catch (LateInitMyArse: kotlin.UninitializedPropertyAccessException) { }
}
diff --git a/src/net/torvald/terrarum/gameactors/ActorInventory.kt b/src/net/torvald/terrarum/gameactors/ActorInventory.kt
index 8ee63e7a9..04700bceb 100644
--- a/src/net/torvald/terrarum/gameactors/ActorInventory.kt
+++ b/src/net/torvald/terrarum/gameactors/ActorInventory.kt
@@ -35,6 +35,8 @@ class ActorInventory(val actor: Pocketed, var maxCapacity: Int, var capacityMode
val itemList = ArrayList()
val quickBar = Array(10, { null }) // 0: Slot 1, 9: Slot 10
+ var currency = 0 // unified currency for whole civs; Dwarf Fortress approach seems too complicated
+
init {
}
diff --git a/src/net/torvald/terrarum/ui/UICanvas.kt b/src/net/torvald/terrarum/ui/UICanvas.kt
index 3af1723d8..8c57dc378 100644
--- a/src/net/torvald/terrarum/ui/UICanvas.kt
+++ b/src/net/torvald/terrarum/ui/UICanvas.kt
@@ -296,4 +296,5 @@ abstract class UICanvas(
LEFT, RIGHT, TOP, BOTTOM
}
}
+
}
diff --git a/src/net/torvald/terrarum/ui/UIInventory.kt b/src/net/torvald/terrarum/ui/UIInventory.kt
index 97ddb465f..03fe794c3 100644
--- a/src/net/torvald/terrarum/ui/UIInventory.kt
+++ b/src/net/torvald/terrarum/ui/UIInventory.kt
@@ -20,7 +20,7 @@ import java.util.*
/**
* Created by minjaesong on 2017-03-13.
*/
-class UIInventory(
+/*class UIInventory(
var actor: Pocketed?,
override var width: Int,
override var height: Int,
@@ -133,14 +133,16 @@ class UIInventory(
posX = categoryWidth,
posY = 0,//(height - controlHelpHeight - scrollImageButtonAtlas.tileH) / 2,
width = scrollImageButtonAtlas.tileW,
- height = height - controlHelpHeight
+ height = height - controlHelpHeight,
+ highlightable = false
)
private val scrollRightButton = UIItemImageButton(this,
scrollImageButtonAtlas.get(1, 0),
posX = width - scrollImageButtonAtlas.tileW,
posY = 0,//(height - controlHelpHeight - scrollImageButtonAtlas.tileH) / 2,
width = scrollImageButtonAtlas.tileW,
- height = height - controlHelpHeight
+ height = height - controlHelpHeight,
+ highlightable = false
)
var itemPage = 0
var itemPageCount = 1 // TODO total size of current category / items.size
@@ -240,14 +242,14 @@ class UIInventory(
batch.color = Color(0xcccccc_ff.toInt())
batch.fillRect(0f, 0f, catButtons.width.toFloat(), height.toFloat())
- catButtons.render(batch)
+ catButtons.render(batch, camera)
// left/right page mover
- scrollLeftButton.render(batch)
- scrollRightButton.render(batch)
+ scrollLeftButton.render(batch, camera)
+ scrollRightButton.render(batch, camera)
items.forEach {
- it.render(batch)
+ it.render(batch, camera)
}
// texts
@@ -322,7 +324,7 @@ class UIInventory(
inventorySortList.sortBy { it.item.name }
// map sortList to item list
- for (k in 0..items.size - 1) {
+ for (k in 0 until items.size) {
// we have an item
try {
val sortListItem = inventorySortList[k + itemPage * items.size]
@@ -427,3 +429,4 @@ class UIInventory(
scrollImageButtonAtlas.dispose()
}
}
+*/
diff --git a/src/net/torvald/terrarum/ui/UIInventoryFull.kt b/src/net/torvald/terrarum/ui/UIInventoryFull.kt
new file mode 100644
index 000000000..6d19cdcbd
--- /dev/null
+++ b/src/net/torvald/terrarum/ui/UIInventoryFull.kt
@@ -0,0 +1,164 @@
+package net.torvald.terrarum.ui
+
+import com.badlogic.gdx.graphics.Camera
+import com.badlogic.gdx.graphics.g2d.SpriteBatch
+import net.torvald.terrarum.RunningEnvironment
+import net.torvald.terrarum.Terrarum
+import net.torvald.terrarum.UIItemInventoryCatBar
+import net.torvald.terrarum.gameactors.InventoryPair
+import net.torvald.terrarum.gameactors.Pocketed
+import net.torvald.terrarum.gameactors.Second
+import net.torvald.terrarum.itemproperties.GameItem
+import net.torvald.terrarum.langpack.Lang
+import java.util.ArrayList
+
+/**
+ * Created by minjaesong on 2017-10-21.
+ */
+class UIInventoryFull(
+ var actor: Pocketed?,
+
+ toggleKeyLiteral: Int? = null, toggleButtonLiteral: Int? = null,
+ // UI positions itself? (you must g.flush() yourself after the g.translate(Int, Int))
+ customPositioning: Boolean = false, // mainly used by vital meter
+ doNotWarnConstant: Boolean = false
+) : UICanvas(toggleKeyLiteral, toggleButtonLiteral, customPositioning, doNotWarnConstant) {
+
+ override var width: Int = Terrarum.WIDTH
+ override var height: Int = Terrarum.HEIGHT
+
+ val internalWidth: Int = 630
+ val internalHeight: Int = 558 // grad_begin..grad_end..contents..grad_begin..grad_end
+
+
+
+ private val SP = "${0x3000.toChar()}${0x3000.toChar()}"
+ val listControlHelp: String
+ get() = if (Terrarum.environment == RunningEnvironment.PC)
+ "${0xe037.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
+ "${0xe006.toChar()} ${Lang["GAME_INVENTORY_USE"]}$SP" +
+ "${0xe011.toChar()}..${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
+ "${0xe034.toChar()} ${Lang["GAME_INVENTORY_DROP"]}"
+ else
+ "${0xe069.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
+ "${Terrarum.joypadLabelNinY} ${Lang["GAME_INVENTORY_USE"]}$SP" +
+ "${0xe011.toChar()}${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
+ "${Terrarum.joypadLabelNinA} ${Lang["GAME_INVENTORY_DROP"]}"
+ val controlHelpHeight = Terrarum.fontGame.lineHeight.toInt()
+
+ private var encumbrancePerc = 0f
+ private var isEncumbered = false
+
+
+ val catBarWidth = 328
+ val catBar = UIItemInventoryCatBar(
+ this,
+ (Terrarum.WIDTH - catBarWidth) / 2,
+ 66 + (Terrarum.HEIGHT - internalHeight) / 2,
+ catBarWidth
+ )
+ val catSelection: Int
+ get() = catBar.selectedIndex
+ val catSelectedIcon: Int
+ get() = catBar.selectedIcon
+
+ override var openCloseTime: Second = 1f
+
+
+ private val itemList: UIItemInventoryDynamicList? =
+ if (actor != null) {
+ UIItemInventoryDynamicList(
+ this,
+ actor!!.inventory,
+ 0 + (Terrarum.WIDTH - internalWidth) / 2,
+ 109 + (Terrarum.HEIGHT - internalHeight) / 2
+ )
+ }
+ else null
+
+
+ init {
+ addItem(catBar)
+ itemList?.let {
+ addItem(it)
+ }
+
+ }
+
+
+ override fun updateUI(delta: Float) {
+
+ }
+
+ override fun renderUI(batch: SpriteBatch, camera: Camera) {
+ catBar.render(batch, camera)
+ itemList?.render(batch, camera)
+ }
+
+
+
+ fun rebuildList() {
+ itemList?.rebuild()
+ }
+
+ override fun dispose() {
+ catBar.dispose()
+ itemList?.dispose()
+ }
+
+
+
+ override fun doOpening(delta: Float) {
+ }
+
+ override fun doClosing(delta: Float) {
+ }
+
+ override fun endOpening(delta: Float) {
+ }
+
+ override fun endClosing(delta: Float) {
+ }
+
+
+
+ override fun resize(width: Int, height: Int) {
+ super.resize(width, height)
+ }
+
+
+
+ override fun keyDown(keycode: Int): Boolean {
+ return super.keyDown(keycode)
+ }
+
+ override fun keyTyped(character: Char): Boolean {
+ return super.keyTyped(character)
+ }
+
+ override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
+ return super.touchDown(screenX, screenY, pointer, button)
+ }
+
+ override fun keyUp(keycode: Int): Boolean {
+ return super.keyUp(keycode)
+ }
+
+ override fun mouseMoved(screenX: Int, screenY: Int): Boolean {
+ return super.mouseMoved(screenX, screenY)
+ }
+
+ override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean {
+ return super.touchDragged(screenX, screenY, pointer)
+ }
+
+ override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
+ return super.touchUp(screenX, screenY, pointer, button)
+ }
+
+ override fun scrolled(amount: Int): Boolean {
+ return super.scrolled(amount)
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/net/torvald/terrarum/ui/UIItem.kt b/src/net/torvald/terrarum/ui/UIItem.kt
index 768447b2d..50e34a606 100644
--- a/src/net/torvald/terrarum/ui/UIItem.kt
+++ b/src/net/torvald/terrarum/ui/UIItem.kt
@@ -1,6 +1,7 @@
package net.torvald.terrarum.ui
import com.badlogic.gdx.Gdx
+import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.Terrarum
@@ -55,6 +56,9 @@ abstract class UIItem(var parentUI: UICanvas) { // do not replace parentUI to UI
get() = mouseUp && Gdx.input.isButtonPressed(Terrarum.getConfigInt("mouseprimary")!!)
+ /** UI to call (show up) while mouse is up */
+ open val mouseOverCall: UICanvas? = null
+
// kind of listener implementation
var updateListener: ((Float) -> Unit)? = null
@@ -76,9 +80,33 @@ abstract class UIItem(var parentUI: UICanvas) { // do not replace parentUI to UI
if (updateListener != null) {
updateListener!!.invoke(delta)
}
+
+
+ mouseOverCall?.update(delta)
+
+ if (mouseUp) {
+ if (mouseOverCall?.isVisible ?: false) {
+ mouseOverCall?.setAsOpen()
+ }
+
+ mouseOverCall?.updateUI(delta)
+ }
+ else {
+ if (mouseOverCall?.isVisible ?: false) {
+ mouseOverCall?.setAsClose()
+ }
+ }
+ }
+ }
+ open fun render(batch: SpriteBatch, camera: Camera) {
+ if (parentUI.isVisible) {
+ mouseOverCall?.render(batch, camera)
+
+ if (mouseUp) {
+ mouseOverCall?.renderUI(batch, camera)
+ }
}
}
- abstract fun render(batch: SpriteBatch)
// keyboard controlled
open fun keyDown(keycode: Int): Boolean {
diff --git a/src/net/torvald/terrarum/ui/UIItemImageButton.kt b/src/net/torvald/terrarum/ui/UIItemImageButton.kt
index 76ea18e1d..97da57fcd 100644
--- a/src/net/torvald/terrarum/ui/UIItemImageButton.kt
+++ b/src/net/torvald/terrarum/ui/UIItemImageButton.kt
@@ -1,5 +1,6 @@
package net.torvald.terrarum.ui
+import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.g2d.TextureRegion
@@ -22,14 +23,21 @@ open class UIItemImageButton(
val activeBackCol: Color = Color(0xb0b0b0_ff.toInt()),
val activeBackBlendMode: String = BlendMode.MULTIPLY,
+ val highlightCol: Color = Color(0x00f8ff_ff),
+ val highlightBackCol: Color = Color(0xb0b0b0_ff.toInt()),
+ val highlightBackBlendMode: String = BlendMode.MULTIPLY,
+
override var posX: Int,
override var posY: Int,
override val width: Int = image.regionWidth,
- override val height: Int = image.regionHeight
+ override val height: Int = image.regionHeight,
+
+ var highlightable: Boolean
) : UIItem(parent) {
+ var highlighted = false
- override fun render(batch: SpriteBatch) {
+ override fun render(batch: SpriteBatch, camera: Camera) {
// draw background
if (mouseUp) {
BlendMode.resolve(activeBackBlendMode)
@@ -46,7 +54,10 @@ open class UIItemImageButton(
// draw image
blendNormal()
- batch.color = if (mouseUp) activeCol else buttonCol
+ batch.color = if (highlighted) highlightCol
+ else if (mouseUp) activeCol
+ else buttonCol
+
batch.draw(image, (posX + (width - image.regionWidth) / 2).toFloat(), (posY + (height - image.regionHeight) / 2).toFloat())
}
@@ -71,6 +82,10 @@ open class UIItemImageButton(
}
override fun touchDown(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean {
+ if (mouseUp) {
+ highlighted = !highlighted
+ }
+
return super.touchDown(screenX, screenY, pointer, button)
}
diff --git a/src/net/torvald/terrarum/ui/UIItemImageGallery.kt b/src/net/torvald/terrarum/ui/UIItemImageGallery.kt
index 1c7284cc9..d9b3ebc8b 100644
--- a/src/net/torvald/terrarum/ui/UIItemImageGallery.kt
+++ b/src/net/torvald/terrarum/ui/UIItemImageGallery.kt
@@ -1,5 +1,6 @@
package net.torvald.terrarum.ui
+import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.gameactors.roundInt
@@ -22,7 +23,7 @@ class UIItemImageGallery(
override fun update(delta: Float) {
}
- override fun render(batch: SpriteBatch) {
+ override fun render(batch: SpriteBatch, camera: Camera) {
fun column(i: Int) = i % column
fun row(i: Int) = i / column
diff --git a/src/net/torvald/terrarum/ui/UIItemInventoryCellBase.kt b/src/net/torvald/terrarum/ui/UIItemInventoryCellBase.kt
new file mode 100644
index 000000000..33ec47230
--- /dev/null
+++ b/src/net/torvald/terrarum/ui/UIItemInventoryCellBase.kt
@@ -0,0 +1,25 @@
+package net.torvald.terrarum.ui
+
+import com.badlogic.gdx.graphics.Camera
+import com.badlogic.gdx.graphics.g2d.SpriteBatch
+import com.badlogic.gdx.graphics.g2d.TextureRegion
+import net.torvald.terrarum.itemproperties.GameItem
+
+/**
+ * Cross section of two inventory cell types
+ *
+ * Created by minjaesong on 2017-10-22.
+ */
+abstract class UIItemInventoryCellBase(
+ parentUI: UIInventoryFull,
+ override var posX: Int,
+ override var posY: Int,
+ open var item: GameItem?,
+ open var amount: Int,
+ open var itemImage: TextureRegion?,
+ open var quickslot: Int? = null,
+ open var equippedSlot: Int? = null
+) : UIItem(parentUI) {
+ abstract override fun update(delta: Float)
+ abstract override fun render(batch: SpriteBatch, camera: Camera)
+}
\ No newline at end of file
diff --git a/src/net/torvald/terrarum/ui/UIItemInventoryDynamicList.kt b/src/net/torvald/terrarum/ui/UIItemInventoryDynamicList.kt
new file mode 100644
index 000000000..ebd1af1e9
--- /dev/null
+++ b/src/net/torvald/terrarum/ui/UIItemInventoryDynamicList.kt
@@ -0,0 +1,192 @@
+package net.torvald.terrarum.ui
+
+import com.badlogic.gdx.graphics.Camera
+import com.badlogic.gdx.graphics.Color
+import com.badlogic.gdx.graphics.g2d.SpriteBatch
+import net.torvald.terrarum.BlendMode
+import net.torvald.terrarum.Terrarum
+import net.torvald.terrarum.UIItemInventoryElem
+import net.torvald.terrarum.UIItemInventoryElemSimple
+import net.torvald.terrarum.console.Inventory
+import net.torvald.terrarum.gameactors.ActorInventory
+import net.torvald.terrarum.gameactors.InventoryPair
+import net.torvald.terrarum.itemproperties.GameItem
+import net.torvald.terrarum.itemproperties.ItemCodex
+import java.util.ArrayList
+
+/**
+ * Display either extended or compact list
+ *
+ * Note: everything is pretty much fixed size.
+ *
+ * Dimension of the whole area: 496x384
+ * Number of grids: 9x7
+ * Number of lists: 2x7
+ *
+ * Created by minjaesong on 2017-10-21.
+ */
+class UIItemInventoryDynamicList(
+ parentUI: UIInventoryFull,
+ val inventory: ActorInventory,
+ override var posX: Int,
+ override var posY: Int
+) : UIItem(parentUI) {
+
+ override val width = 496
+ override val height = 384
+
+
+
+
+ val catIconsMeaning = listOf( // sortedBy: catArrangement
+ GameItem.Category.WEAPON,
+ GameItem.Category.TOOL,
+ GameItem.Category.ARMOUR,
+ GameItem.Category.GENERIC,
+ GameItem.Category.POTION,
+ GameItem.Category.MAGIC,
+ GameItem.Category.BLOCK,
+ GameItem.Category.WALL,
+ GameItem.Category.MISC,
+ "__all__"
+ )
+
+ private val inventoryUI = parentUI
+
+ private val selection: Int
+ get() = inventoryUI.catSelection
+ private val selectedIcon: Int
+ get() = inventoryUI.catSelectedIcon
+
+ private val compactViewCat = setOf(6, 7, 9) // blocks, walls, all (spritesheet order)
+
+ var itemPage = 0
+ var itemPageCount = 1 // TODO total size of current category / items.size
+
+ var inventorySortList = ArrayList()
+ private var rebuildList = true
+
+ val defaultTextColour = Color(0xeaeaea_ff.toInt())
+
+ private val listGap = 8
+ private val itemList = Array(
+ 7 * 2, {
+ UIItemInventoryElem(
+ parentUI = inventoryUI,
+ posX = this.posX + (244 + listGap) * (it % 2),
+ posY = this.posY + (UIItemInventoryElem.height + listGap) * (it / 2),
+ width = 244,
+ item = null,
+ amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT,
+ itemImage = null,
+ mouseoverBackCol = Color(0x282828_ff),
+ mouseoverBackBlendMode = BlendMode.SCREEN,
+ backCol = Color(0xd4d4d4_ff.toInt()),
+ backBlendMode = BlendMode.MULTIPLY,
+ drawBackOnNull = true,
+ inactiveTextCol = defaultTextColour
+ ) })
+ private val itemGrid = Array(
+ 7 * 9, {
+ UIItemInventoryElemSimple(
+ parentUI = inventoryUI,
+ posX = this.posX + (UIItemInventoryElemSimple.height + listGap) * (it % 9),
+ posY = this.posY + (UIItemInventoryElemSimple.height + listGap) * (it / 9),
+ item = null,
+ amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT,
+ itemImage = null,
+ mouseoverBackCol = Color(0x282828_ff),
+ mouseoverBackBlendMode = BlendMode.SCREEN,
+ backCol = Color(0xd4d4d4_ff.toInt()),
+ backBlendMode = BlendMode.MULTIPLY,
+ drawBackOnNull = true,
+ inactiveTextCol = defaultTextColour
+ )
+ }
+ )
+
+ private val items: Array
+ get() = if (selection in compactViewCat) itemGrid else itemList
+
+
+
+ override fun render(batch: SpriteBatch, camera: Camera) {
+
+ items.forEach { it.render(batch, camera) }
+
+
+ super.render(batch, camera)
+ }
+
+
+ override fun update(delta: Float) {
+ super.update(delta)
+
+ items.forEach { it.update(delta) }
+ }
+
+
+
+ internal fun rebuild() {
+ val filter = catIconsMeaning[selectedIcon]
+
+ inventorySortList = ArrayList()
+
+ // filter items
+ inventory.forEach {
+ if (it.item.inventoryCategory == filter || filter == "__all__")
+ inventorySortList.add(it)
+ }
+
+ rebuildList = false
+
+ // sort if needed
+ // test sort by name
+ inventorySortList.sortBy { it.item.name }
+
+ // map sortList to item list
+ for (k in 0 until items.size) {
+ // we have an item
+ try {
+ val sortListItem = inventorySortList[k + itemPage * items.size]
+ items[k].item = sortListItem.item
+ items[k].amount = sortListItem.amount
+ items[k].itemImage = ItemCodex.getItemImage(sortListItem.item)
+
+ // set quickslot number
+ for (qs in 1..UIQuickBar.SLOT_COUNT) {
+ if (sortListItem.item == inventory.getQuickBar(qs - 1)?.item) {
+ items[k].quickslot = qs % 10 // 10 -> 0, 1..9 -> 1..9
+ break
+ }
+ else
+ items[k].quickslot = null
+ }
+
+ // set equippedslot number
+ for (eq in 0 until inventory.itemEquipped.size) {
+ if (eq < inventory.itemEquipped.size) {
+ if (inventory.itemEquipped[eq] == items[k].item) {
+ items[k].equippedSlot = eq
+ break
+ }
+ else
+ items[k].equippedSlot = null
+ }
+ }
+ }
+ // we do not have an item, empty the slot
+ catch (e: IndexOutOfBoundsException) {
+ items[k].item = null
+ items[k].amount = 0
+ items[k].itemImage = null
+ items[k].quickslot = null
+ }
+ }
+ }
+
+ override fun dispose() {
+ itemList.forEach { it.dispose() }
+ itemGrid.forEach { it.dispose() }
+ }
+}
diff --git a/src/net/torvald/terrarum/ui/UIItemList.kt b/src/net/torvald/terrarum/ui/UIItemList.kt
index 0f3d5f1c4..d4ec6e72b 100644
--- a/src/net/torvald/terrarum/ui/UIItemList.kt
+++ b/src/net/torvald/terrarum/ui/UIItemList.kt
@@ -1,5 +1,6 @@
package net.torvald.terrarum.ui
+import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.BlendMode
@@ -103,7 +104,7 @@ class UIItemList(
}
}
- override fun render(batch: SpriteBatch) {
+ override fun render(batch: SpriteBatch, camera: Camera) {
batch.color = backgroundCol
BlendMode.resolve(backgroundBlendMode)
batch.fillRect(posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
@@ -114,7 +115,7 @@ class UIItemList(
batch.fillRect(posX.toFloat(), highlightY!!.toFloat(), width.toFloat(), UIItemTextButton.height.toFloat())
}
- itemList.forEach { it.render(batch) }
+ itemList.forEach { it.render(batch, camera) }
batch.color = backgroundCol
}
diff --git a/src/net/torvald/terrarum/ui/UIItemModuleInfoCell.kt b/src/net/torvald/terrarum/ui/UIItemModuleInfoCell.kt
index 24ee19df7..752a141a8 100644
--- a/src/net/torvald/terrarum/ui/UIItemModuleInfoCell.kt
+++ b/src/net/torvald/terrarum/ui/UIItemModuleInfoCell.kt
@@ -1,5 +1,6 @@
package net.torvald.terrarum.ui
+import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.ModMgr
@@ -19,7 +20,7 @@ class UIItemModuleInfoCell(
private val numberAreaWidth = Terrarum.fontSmallNumbers.W * 3 + 4
- override fun render(batch: SpriteBatch) {
+ override fun render(batch: SpriteBatch, camera: Camera) {
blendNormal()
if (ModMgr.moduleInfo.containsKey(moduleName)) {
diff --git a/src/net/torvald/terrarum/ui/UIItemTextArea.kt b/src/net/torvald/terrarum/ui/UIItemTextArea.kt
index d87a185fe..53481dd99 100644
--- a/src/net/torvald/terrarum/ui/UIItemTextArea.kt
+++ b/src/net/torvald/terrarum/ui/UIItemTextArea.kt
@@ -1,5 +1,6 @@
package net.torvald.terrarum.ui
+import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import net.torvald.terrarum.Terrarum
@@ -38,7 +39,7 @@ class UIItemTextArea(
if (scrollPos < 0) scrollPos = 0
}
- override fun render(batch: SpriteBatch) {
+ override fun render(batch: SpriteBatch, camera: Camera) {
for (i in scrollPos until minOf(lineCount + scrollPos, entireText.size)) {
val yPtr = i - scrollPos
diff --git a/src/net/torvald/terrarum/ui/UIItemTextButton.kt b/src/net/torvald/terrarum/ui/UIItemTextButton.kt
index af32f9cfb..ed56b9ead 100644
--- a/src/net/torvald/terrarum/ui/UIItemTextButton.kt
+++ b/src/net/torvald/terrarum/ui/UIItemTextButton.kt
@@ -1,5 +1,6 @@
package net.torvald.terrarum.ui
+import com.badlogic.gdx.graphics.Camera
import net.torvald.terrarum.*
import net.torvald.terrarum.langpack.Lang
import com.badlogic.gdx.graphics.Color
@@ -46,7 +47,7 @@ open class UIItemTextButton(
private val glyphLayout = GlyphLayout()
- override fun render(batch: SpriteBatch) {
+ override fun render(batch: SpriteBatch, camera: Camera) {
val textW = font.getWidth(label)
diff --git a/src/net/torvald/terrarum/ui/UIItemTextButtonList.kt b/src/net/torvald/terrarum/ui/UIItemTextButtonList.kt
index b1a861792..b7789b842 100644
--- a/src/net/torvald/terrarum/ui/UIItemTextButtonList.kt
+++ b/src/net/torvald/terrarum/ui/UIItemTextButtonList.kt
@@ -1,5 +1,6 @@
package net.torvald.terrarum.ui
+import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
@@ -175,7 +176,7 @@ class UIItemTextButtonList(
}
}
- override fun render(batch: SpriteBatch) {
+ override fun render(batch: SpriteBatch, camera: Camera) {
batch.color = backgroundCol
BlendMode.resolve(backgroundBlendMode)
@@ -187,7 +188,7 @@ class UIItemTextButtonList(
batch.fillRect(posX.toFloat(), highlightY!!.toFloat(), width.toFloat(), UIItemTextButton.height.toFloat())
}
- buttons.forEach { it.render(batch) }
+ buttons.forEach { it.render(batch, camera) }
if (iconSpriteSheet != null) {
diff --git a/src/net/torvald/terrarum/ui/UITitleRemoConCredits.kt b/src/net/torvald/terrarum/ui/UITitleRemoConCredits.kt
index 1e682b85c..10a2fbd6b 100644
--- a/src/net/torvald/terrarum/ui/UITitleRemoConCredits.kt
+++ b/src/net/torvald/terrarum/ui/UITitleRemoConCredits.kt
@@ -89,10 +89,10 @@ class UITitleRemoConCredits(val superMenu: UICanvas) : UICanvas() {
}
override fun renderUI(batch: SpriteBatch, camera: Camera) {
- menubar.render(batch)
+ menubar.render(batch, camera)
if (drawTextArea) {
batch.color = Color.WHITE
- textArea.render(batch)
+ textArea.render(batch, camera)
}
}
diff --git a/src/net/torvald/terrarum/ui/UITitleRemoConLanguage.kt b/src/net/torvald/terrarum/ui/UITitleRemoConLanguage.kt
index 75fa6bf6e..2db7b06f0 100644
--- a/src/net/torvald/terrarum/ui/UITitleRemoConLanguage.kt
+++ b/src/net/torvald/terrarum/ui/UITitleRemoConLanguage.kt
@@ -87,10 +87,10 @@ class UITitleRemoConLanguage(val superMenu: UICanvas) : UICanvas() {
}
override fun renderUI(batch: SpriteBatch, camera: Camera) {
- menubar.render(batch)
+ menubar.render(batch, camera)
batch.color = Color.WHITE
- textArea.render(batch)
+ textArea.render(batch, camera)
}
override fun doOpening(delta: Float) {
diff --git a/src/net/torvald/terrarum/ui/UITitleRemoConModules.kt b/src/net/torvald/terrarum/ui/UITitleRemoConModules.kt
index 25fd4b55e..8ed8b3b70 100644
--- a/src/net/torvald/terrarum/ui/UITitleRemoConModules.kt
+++ b/src/net/torvald/terrarum/ui/UITitleRemoConModules.kt
@@ -96,11 +96,11 @@ class UITitleRemoConModules(val superMenu: UICanvas) : UICanvas() {
}
override fun renderUI(batch: SpriteBatch, camera: Camera) {
- menubar.render(batch)
+ menubar.render(batch, camera)
batch.color = Color.WHITE
blendNormal()
- mouduleArea.render(batch)
+ mouduleArea.render(batch, camera)
}
override fun doOpening(delta: Float) {
diff --git a/src/net/torvald/terrarum/ui/UITitleRemoConRoot.kt b/src/net/torvald/terrarum/ui/UITitleRemoConRoot.kt
index aaafcb664..bc4f367cf 100644
--- a/src/net/torvald/terrarum/ui/UITitleRemoConRoot.kt
+++ b/src/net/torvald/terrarum/ui/UITitleRemoConRoot.kt
@@ -110,7 +110,7 @@ class UITitleRemoConRoot : UICanvas() {
}
override fun renderUI(batch: SpriteBatch, camera: Camera) {
- menubar.render(batch)
+ menubar.render(batch, camera)
}
override fun doOpening(delta: Float) {
diff --git a/work_files/graphics/fonts/ascii_variable.psd b/work_files/graphics/fonts/ascii_variable.psd
index 46edc841b..94ab16a82 100644
--- a/work_files/graphics/fonts/ascii_variable.psd
+++ b/work_files/graphics/fonts/ascii_variable.psd
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:3f1bcf35e55bdbe0191dd096d16220770d717015038bda7cc063e134fb8afc03
-size 326990
+oid sha256:41de48ba2d59d01d1216315a82ae40f3d683a8d08ab00aa23bd6b790dd67a41f
+size 327047