mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 16:46:07 +09:00
Inventory UI: items page button
This commit is contained in:
@@ -9,7 +9,7 @@ uniform vec3 bottomColor;
|
|||||||
|
|
||||||
// "steps" of R, G and B. Must be integer && equal or greater than 2
|
// "steps" of R, G and B. Must be integer && equal or greater than 2
|
||||||
uniform float rcount = 64.0; // it even works on 256.0!
|
uniform float rcount = 64.0; // it even works on 256.0!
|
||||||
uniform float gcount = 64.0; // using 128: has less banding and most monitors are internally 6-bit
|
uniform float gcount = 64.0; // using 64: has less banding and most monitors are internally 6-bit
|
||||||
uniform float bcount = 64.0;
|
uniform float bcount = 64.0;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -80,11 +80,12 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
|||||||
|
|
||||||
|
|
||||||
private val worldFBOformat = if (Terrarum.environment == RunningEnvironment.MOBILE) Pixmap.Format.RGBA4444 else Pixmap.Format.RGBA8888
|
private val worldFBOformat = if (Terrarum.environment == RunningEnvironment.MOBILE) Pixmap.Format.RGBA4444 else Pixmap.Format.RGBA8888
|
||||||
|
private val worldBlendFBOFormat = if (Terrarum.environment == RunningEnvironment.MOBILE) Pixmap.Format.RGBA4444 else Pixmap.Format.RGBA8888
|
||||||
private val lightFBOformat = Pixmap.Format.RGB888
|
private val lightFBOformat = Pixmap.Format.RGB888
|
||||||
|
|
||||||
var worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
var worldDrawFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||||
var worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
var worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||||
var worldBlendFrameBuffer = FrameBuffer(Pixmap.Format.RGB888, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
var worldBlendFrameBuffer = FrameBuffer(worldBlendFBOFormat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||||
// RGB elements of Lightmap for Color Vec4(R, G, B, 1.0) 24-bit
|
// RGB elements of Lightmap for Color Vec4(R, G, B, 1.0) 24-bit
|
||||||
var lightmapFboA = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), false)
|
var lightmapFboA = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), false)
|
||||||
var lightmapFboB = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), false)
|
var lightmapFboB = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), false)
|
||||||
@@ -1516,7 +1517,7 @@ class Ingame(val batch: SpriteBatch) : Screen {
|
|||||||
worldGlowFrameBuffer.dispose()
|
worldGlowFrameBuffer.dispose()
|
||||||
worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
worldGlowFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||||
worldBlendFrameBuffer.dispose()
|
worldBlendFrameBuffer.dispose()
|
||||||
worldBlendFrameBuffer = FrameBuffer(worldFBOformat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
worldBlendFrameBuffer = FrameBuffer(worldBlendFBOFormat, Terrarum.WIDTH, Terrarum.HEIGHT, false)
|
||||||
lightmapFboA.dispose()
|
lightmapFboA.dispose()
|
||||||
lightmapFboA = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), false)
|
lightmapFboA = FrameBuffer(lightFBOformat, Terrarum.WIDTH.div(lightmapDownsample.toInt()), Terrarum.HEIGHT.div(lightmapDownsample.toInt()), false)
|
||||||
lightmapFboB.dispose()
|
lightmapFboB.dispose()
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class UIInventory(
|
|||||||
posY = (height - controlHelpHeight - scrollImageButtonAtlas.tileH) / 2
|
posY = (height - controlHelpHeight - scrollImageButtonAtlas.tileH) / 2
|
||||||
)
|
)
|
||||||
var itemPage = 0
|
var itemPage = 0
|
||||||
var maxItemPage = 1 // TODO total size of current category / items.size
|
var itemPageCount = 1 // TODO total size of current category / items.size
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -172,13 +172,13 @@ class UIInventory(
|
|||||||
scrollLeftButton.clickOnceAction = { mouseX, mouseY, button -> // click once action doesn't work ?!
|
scrollLeftButton.clickOnceAction = { mouseX, mouseY, button -> // click once action doesn't work ?!
|
||||||
if (button == Input.Buttons.LEFT) {
|
if (button == Input.Buttons.LEFT) {
|
||||||
println("prevpage")
|
println("prevpage")
|
||||||
itemPage = (itemPage - 1) fmod maxItemPage
|
itemPage = (itemPage - 1) fmod itemPageCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
scrollRightButton.clickOnceAction = { mouseX, mouseY, button ->
|
scrollRightButton.clickOnceAction = { mouseX, mouseY, button ->
|
||||||
if (button == Input.Buttons.LEFT) {
|
if (button == Input.Buttons.LEFT) {
|
||||||
println("nextpage")
|
println("nextpage")
|
||||||
itemPage = (itemPage + 1) fmod maxItemPage
|
itemPage = (itemPage + 1) fmod itemPageCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,6 +206,10 @@ class UIInventory(
|
|||||||
rebuildList = true
|
rebuildList = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reset item page to start
|
||||||
|
if (oldCatSelect != catButtons.selectedIndex) {
|
||||||
|
itemPage = 0
|
||||||
|
}
|
||||||
|
|
||||||
if (rebuildList) {
|
if (rebuildList) {
|
||||||
shutUpAndRebuild()
|
shutUpAndRebuild()
|
||||||
@@ -349,6 +353,9 @@ class UIInventory(
|
|||||||
items[k].quickslot = null
|
items[k].quickslot = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
itemPageCount = maxOf(1, 1 + (inventorySortList.size.minus(1) / items.size))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user