diff --git a/assets/U2415 #1 2017-10-22 23-00 120cdm² D6000 sRGB M-S XYZLUT.Rec709.bb1.0,2.2Gawn6516.png b/assets/clut/U2415 #1 2017-10-22 23-00 120cdm² D6000 sRGB M-S XYZLUT.Rec709.bb1.0,2.2Gawn6516.png similarity index 100% rename from assets/U2415 #1 2017-10-22 23-00 120cdm² D6000 sRGB M-S XYZLUT.Rec709.bb1.0,2.2Gawn6516.png rename to assets/clut/U2415 #1 2017-10-22 23-00 120cdm² D6000 sRGB M-S XYZLUT.Rec709.bb1.0,2.2Gawn6516.png diff --git a/assets/graphics/gui/inventory/category.tga b/assets/graphics/gui/inventory/category.tga index 86dc2ff22..d02142c30 100644 --- a/assets/graphics/gui/inventory/category.tga +++ b/assets/graphics/gui/inventory/category.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:84d51489fad142e1f47cc8d70452d8325b333ed8e52e520bf5b345b494e96950 -size 25644 +oid sha256:d28e7271e03aa4898b8f5d90f0021b29cffc2ebf0988e0ade5acb444c1b7a8e6 +size 28844 diff --git a/lib/kotlin-reflect.jar b/lib/kotlin-reflect.jar index dd38a93bd..83439d248 100755 Binary files a/lib/kotlin-reflect.jar and b/lib/kotlin-reflect.jar differ diff --git a/lib/kotlin-stdlib.jar b/lib/kotlin-stdlib.jar index 9569a6713..b7cc29ec3 100644 Binary files a/lib/kotlin-stdlib.jar and b/lib/kotlin-stdlib.jar differ diff --git a/src/net/torvald/terrarum/PostProcessor.kt b/src/net/torvald/terrarum/PostProcessor.kt index f1828d6b8..f70ebc5a0 100644 --- a/src/net/torvald/terrarum/PostProcessor.kt +++ b/src/net/torvald/terrarum/PostProcessor.kt @@ -2,6 +2,7 @@ package net.torvald.terrarum import com.badlogic.gdx.Gdx import com.badlogic.gdx.graphics.GL20 +import com.badlogic.gdx.graphics.Texture import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.glutils.FrameBuffer @@ -9,6 +10,12 @@ object PostProcessor { private val batch = SpriteBatch() + private lateinit var lutTex: Texture + + fun reloadLUT(filename: String) { + lutTex = Texture(Gdx.files.internal("assets/clut/$filename")) + } + fun draw(screenTexHolder: FrameBuffer) { //Gdx.gl.glClearColor(.094f, .094f, .094f, 1f) //Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT) diff --git a/src/net/torvald/terrarum/UIItemInventoryCatBar.kt b/src/net/torvald/terrarum/UIItemInventoryCatBar.kt index 70640fc37..5f100cf6b 100644 --- a/src/net/torvald/terrarum/UIItemInventoryCatBar.kt +++ b/src/net/torvald/terrarum/UIItemInventoryCatBar.kt @@ -9,38 +9,38 @@ 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, + parentUI: UIInventoryFull, override var posX: Int, override var posY: Int, override val width: Int ) : UIItem(parentUI) { - private val catIcons = (parentUI as UIInventoryFull).catIcons - private val catArrangement = (parentUI as UIInventoryFull).catArrangement + private val catIcons = parentUI.catIcons + private val catArrangement = parentUI.catArrangement private val inventoryUI = parentUI override val height = catIcons.tileH + 5 - private val buttons: Array + private val mainButtons: Array private val buttonGapSize = (width.toFloat() - (catArrangement.size * catIcons.tileW)) / (catArrangement.size) var selectedIndex = 0 // default to ALL private set val selectedIcon: Int get() = catArrangement[selectedIndex] - private val catSelectionOld = 0 // default to ALL - // set up buttons + private val sideButtons: Array + + // set up all the buttons init { // place sub UIs: Image Buttons - buttons = Array(catArrangement.size, { index -> + mainButtons = Array(catArrangement.size, { index -> val iconPosX = ((buttonGapSize / 2) + index * (catIcons.tileW + buttonGapSize)).roundInt() val iconPosY = 0 @@ -54,14 +54,46 @@ class UIItemInventoryCatBar( highlightable = true ) }) + + + // side buttons + // NOTE: < > arrows must "highlightable = false"; "true" otherwise + // determine gaps: hacky way exploiting that we already know the catbar is always at the c of the ui + val relativeStartX = posX - (parentUI.internalWidth - width) / 2 + val sideButtonsGap = (((parentUI.internalWidth - width) / 2) - 2f * catIcons.tileW) / 3f + val iconIndex = arrayOf(12, 16, 17, 13) + + + println(relativeStartX) + println(posX) + + sideButtons = Array(iconIndex.size, { index -> + val iconPosX = if (index < 2) + (relativeStartX + sideButtonsGap + (sideButtonsGap + catIcons.tileW) * index).roundInt() + else + (relativeStartX + width + 2 * sideButtonsGap + (sideButtonsGap + catIcons.tileW) * index).roundInt() + val iconPosY = 0 + + UIItemImageButton( + inventoryUI, + catIcons.get(iconIndex[index], 0), + activeBackCol = Color(0), + activeBackBlendMode = BlendMode.NORMAL, + posX = iconPosX, + posY = posY + iconPosY, + buttonCol = if (index == 0 || index == 3) Color.WHITE else Color(0xffffff7f.toInt()), + activeCol = if (index == 0 || index == 3) Color(0xfff066_ff.toInt()) else Color(0xffffff7f.toInt()), + highlightable = (index == 0 || index == 3) + ) + }) } private val underlineIndTex: Texture private val underlineColour = Color(0xeaeaea_40.toInt()) - private val underlineHighlightColour = buttons[0].highlightCol + private val underlineHighlightColour = mainButtons[0].highlightCol - private var highlighterXPos = buttons[selectedIndex].posX.toDouble() + private var highlighterXPos = mainButtons[selectedIndex].posX.toDouble() private var highlighterXStart = highlighterXPos private var highlighterXEnd = highlighterXPos @@ -87,7 +119,7 @@ class UIItemInventoryCatBar( pixmap.dispose() - buttons[selectedIndex].highlighted = true + mainButtons[selectedIndex].highlighted = true } @@ -117,23 +149,26 @@ class UIItemInventoryCatBar( } - buttons.forEachIndexed { index, btn -> + mainButtons.forEachIndexed { index, btn -> btn.update(delta) if (btn.mousePushed && index != selectedIndex) { val oldIndex = selectedIndex - highlighterXStart = buttons[selectedIndex].posX.toDouble() // using old selectedIndex + highlighterXStart = mainButtons[selectedIndex].posX.toDouble() // using old selectedIndex selectedIndex = index highlighterMoving = true - highlighterXEnd = buttons[selectedIndex].posX.toDouble() // using new selectedIndex + highlighterXEnd = mainButtons[selectedIndex].posX.toDouble() // using new selectedIndex selectionChangeListener?.invoke(oldIndex, index) } btn.highlighted = (index == selectedIndex) // forcibly highlight if this.highlighted != null } + + sideButtons[0].update(delta) + sideButtons[3].update(delta) } override fun render(batch: SpriteBatch, camera: Camera) { @@ -141,7 +176,8 @@ class UIItemInventoryCatBar( // button // colour determined by UI items themselves - buttons.forEach { it.render(batch, camera) } + mainButtons.forEach { it.render(batch, camera) } + sideButtons.forEach { it.render(batch, camera) } blendNormal(batch) @@ -162,5 +198,7 @@ class UIItemInventoryCatBar( override fun dispose() { underlineIndTex.dispose() catIcons.dispose() + mainButtons.forEach { it.dispose() } + sideButtons.forEach { it.dispose() } } } \ No newline at end of file diff --git a/work_files/UI/inventory_nouveau_2.psd b/work_files/UI/inventory_nouveau_2.psd index e89d07f5f..b68c8266d 100644 --- a/work_files/UI/inventory_nouveau_2.psd +++ b/work_files/UI/inventory_nouveau_2.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0c232e82cc40d651116ec3d413855544309732676a714f393d80e14ead4e7087 -size 3104905 +oid sha256:7d7da8dec5912953d7ea5b5d759eec790b1726652a1f51481c368b64657d685b +size 3112111