mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
inventory ui update
This commit is contained in:
@@ -33,6 +33,7 @@ class UIInventory(
|
||||
val catButtonsToCatIdent = HashMap<String, String>()
|
||||
|
||||
val backgroundColour = Color(0x80242424.toInt())
|
||||
val defaultTextColour = Color(0xeaeaea)
|
||||
|
||||
init {
|
||||
catButtonsToCatIdent.put("GAME_INVENTORY_WEAPONS", InventoryItem.Category.WEAPON)
|
||||
@@ -79,11 +80,13 @@ class UIInventory(
|
||||
defaultSelection = 0,
|
||||
iconSpriteSheet = SpriteSheet("./assets/graphics/gui/inventory/category.tga", 20, 20),
|
||||
iconSpriteSheetIndices = intArrayOf(9,6,7,0,1,2,3,4,5,8),
|
||||
iconCol = defaultTextColour,
|
||||
highlightBackCol = Color(0xb8b8b8),
|
||||
highlightBackBlendMode = BlendMode.MULTIPLY,
|
||||
backgroundCol = Color(0,0,0,0), // will use custom background colour!
|
||||
backgroundBlendMode = BlendMode.NORMAL,
|
||||
kinematic = true
|
||||
kinematic = true,
|
||||
inactiveCol = defaultTextColour
|
||||
)
|
||||
|
||||
val itemsStripWidth = ((width - catButtons.width) - (2 * itemStripGutterH + itemInterColGutter)) / 2
|
||||
@@ -101,7 +104,8 @@ class UIInventory(
|
||||
mouseoverBackBlendMode = BlendMode.SCREEN,
|
||||
backCol = Color(0xd4d4d4),
|
||||
backBlendMode = BlendMode.MULTIPLY,
|
||||
drawBackOnNull = true
|
||||
drawBackOnNull = true,
|
||||
inactiveTextCol = defaultTextColour
|
||||
) })
|
||||
val itemsScrollOffset = 0
|
||||
|
||||
@@ -234,7 +238,7 @@ class UIInventory(
|
||||
|
||||
// texts
|
||||
blendNormal()
|
||||
g.color = Color(0xe8e8e8)
|
||||
g.color = defaultTextColour
|
||||
// W - close
|
||||
g.drawString(listControlClose, 4f, height - controlHelpHeight.toFloat())
|
||||
// MouseL - Use ; 1.9 - Register ; T - Drop
|
||||
|
||||
@@ -26,18 +26,19 @@ class UIItemTextButtonList(
|
||||
val textAreaWidth: Int,
|
||||
val iconSpriteSheet: SpriteSheet? = null,
|
||||
val iconSpriteSheetIndices: IntArray? = null,
|
||||
val iconCol: Color = UIItemTextButton.defaultInactiveCol,
|
||||
|
||||
// copied directly from UIItemTextButton
|
||||
val activeCol: Color = Color(0xfff066),
|
||||
val activeBackCol: Color = Color(0,0,0,0),
|
||||
val activeBackCol: Color = Color(0, 0, 0, 0),
|
||||
val activeBackBlendMode: String = BlendMode.NORMAL,
|
||||
val highlightCol: Color = Color(0x00f8ff),
|
||||
val highlightBackCol: Color = Color(0xb0b0b0),
|
||||
val highlightBackBlendMode: String = BlendMode.MULTIPLY,
|
||||
val inactiveCol: Color = Color(0xc0c0c0),
|
||||
val backgroundCol: Color = Color(0,0,0,0),
|
||||
val backgroundCol: Color = Color(0, 0, 0, 0),
|
||||
val backgroundBlendMode: String = BlendMode.NORMAL,
|
||||
val kinematic: Boolean = false // more "kinetic" movement of selector
|
||||
val kinematic: Boolean = false
|
||||
) : UIItem(parentUI) {
|
||||
|
||||
val iconToTextGap = 20
|
||||
@@ -158,7 +159,8 @@ class UIItemTextButtonList(
|
||||
iconSpriteSheetIndices!!.forEachIndexed { counter, imageIndex ->
|
||||
iconSpriteSheet.getSubImage(imageIndex, 0).draw(
|
||||
32f,
|
||||
buttons[counter].posY + iconY.toFloat()
|
||||
buttons[counter].posY + iconY.toFloat(),
|
||||
iconCol
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,11 @@ class UIVitalMetre(
|
||||
val order: Int
|
||||
) : UICanvas {
|
||||
|
||||
init {
|
||||
// semitransparent
|
||||
color?.a = 0.91f
|
||||
}
|
||||
|
||||
private val margin = 25
|
||||
private val gap = 4f
|
||||
|
||||
@@ -45,7 +50,12 @@ class UIVitalMetre(
|
||||
private val theta = 33f
|
||||
private val halfTheta = theta / 2f
|
||||
|
||||
private val backColor: Color; get() = color?.darkerLab(0.4f) ?: Color.black
|
||||
private val backColor: Color
|
||||
get(): Color {
|
||||
val c = (color?.darkerLab(0.33f) ?: Color.black)
|
||||
c.a = 0.7f
|
||||
return c
|
||||
}
|
||||
|
||||
|
||||
override fun update(gc: GameContainer, delta: Int) {
|
||||
@@ -66,9 +76,11 @@ class UIVitalMetre(
|
||||
)
|
||||
|
||||
|
||||
|
||||
g.lineWidth = 2f
|
||||
|
||||
|
||||
val ratio = minOf(1f, vitalGetterVal()!! / vitalGetterMax()!!)
|
||||
|
||||
// background
|
||||
g.color = backColor
|
||||
g.drawArc(
|
||||
@@ -77,7 +89,7 @@ class UIVitalMetre(
|
||||
circleRadius * 2f + order * gap * 2,
|
||||
circleRadius * 2f + order * gap * 2,
|
||||
90f - halfTheta,
|
||||
90f + halfTheta - theta * (vitalGetterVal()!! / vitalGetterMax()!!)
|
||||
90f + halfTheta - theta * ratio
|
||||
)
|
||||
|
||||
g.color = color
|
||||
@@ -86,7 +98,7 @@ class UIVitalMetre(
|
||||
-circleRadius - order * gap - offsetY,
|
||||
circleRadius * 2f + order * gap * 2,
|
||||
circleRadius * 2f + order * gap * 2,
|
||||
90f + halfTheta - theta * (vitalGetterVal()!! / vitalGetterMax()!!),
|
||||
90f + halfTheta - theta * ratio,
|
||||
90f + halfTheta
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user