mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
fixed a bug where inventory cell would not position correctly when streamermode is changed; where screencapturing for saving would only capture from FboRGB
This commit is contained in:
@@ -42,8 +42,8 @@ internal class UIInventoryCells(
|
||||
full,
|
||||
full.catBar,
|
||||
{ full.actor.inventory },
|
||||
INVENTORY_CELLS_OFFSET_X,
|
||||
INVENTORY_CELLS_OFFSET_Y,
|
||||
INVENTORY_CELLS_OFFSET_X(),
|
||||
INVENTORY_CELLS_OFFSET_Y(),
|
||||
CELLS_HOR, CELLS_VRT,
|
||||
keyDownFun = createInvCellGenericKeyDownFun(),
|
||||
touchDownFun = createInvCellGenericTouchDownFun { rebuildList() }
|
||||
@@ -54,7 +54,7 @@ internal class UIInventoryCells(
|
||||
UIItemInventoryEquippedView(
|
||||
full,
|
||||
internalWidth - UIItemInventoryEquippedView.WIDTH + (width - internalWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y,
|
||||
INVENTORY_CELLS_OFFSET_Y(),
|
||||
{ rebuildList() }
|
||||
)
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
private val gameMenuButtons = UIItemTextButtonList(
|
||||
this, DEFAULT_LINE_HEIGHT, gameMenu,
|
||||
(width - gameMenuListWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - gameMenuListHeight) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y() + (INVENTORY_CELLS_UI_HEIGHT - gameMenuListHeight) / 2,
|
||||
gameMenuListWidth, gameMenuListHeight,
|
||||
readFromLang = true,
|
||||
textAreaWidth = gameMenuListWidth,
|
||||
@@ -47,7 +47,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
private val areYouSureMainMenuButtons = UIItemTextButtonList(
|
||||
this, DEFAULT_LINE_HEIGHT, arrayOf("MENU_LABEL_RETURN_MAIN_QUESTION", "MENU_LABEL_RETURN_MAIN", "MENU_LABEL_CANCEL"),
|
||||
(width - gameMenuListWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y() + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2,
|
||||
gameMenuListWidth, DEFAULT_LINE_HEIGHT * 3,
|
||||
readFromLang = true,
|
||||
textAreaWidth = gameMenuListWidth,
|
||||
@@ -60,7 +60,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
private val areYouSureQuitButtons = UIItemTextButtonList(
|
||||
this, DEFAULT_LINE_HEIGHT, arrayOf("MENU_LABEL_DESKTOP_QUESTION", "MENU_LABEL_DESKTOP", "MENU_LABEL_CANCEL"),
|
||||
(width - gameMenuListWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y() + (INVENTORY_CELLS_UI_HEIGHT - (DEFAULT_LINE_HEIGHT * 3)) / 2,
|
||||
gameMenuListWidth, DEFAULT_LINE_HEIGHT * 3,
|
||||
readFromLang = true,
|
||||
textAreaWidth = gameMenuListWidth,
|
||||
|
||||
@@ -49,8 +49,8 @@ class UIInventoryFull(
|
||||
val itemListHeight: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * net.torvald.terrarum.modulebasegame.ui.UIItemInventoryItemGrid.Companion.listGap
|
||||
|
||||
val INVENTORY_CELLS_UI_HEIGHT: Int = CELLS_VRT * UIItemInventoryElemSimple.height + (CELLS_VRT - 1) * UIItemInventoryItemGrid.listGap
|
||||
val INVENTORY_CELLS_OFFSET_X = 0 + (Toolkit.drawWidth - internalWidth) / 2
|
||||
val INVENTORY_CELLS_OFFSET_Y: Int = 107 + (App.scr.height - internalHeight) / 2
|
||||
val INVENTORY_CELLS_OFFSET_X = { 0 + (Toolkit.drawWidth - internalWidth) / 2 }
|
||||
val INVENTORY_CELLS_OFFSET_Y = { 107 + (App.scr.height - internalHeight) / 2 }
|
||||
|
||||
val catBarWidth = 330
|
||||
|
||||
@@ -164,7 +164,7 @@ class UIInventoryFull(
|
||||
private val transitionPanel = UIItemHorizontalFadeSlide(
|
||||
this,
|
||||
(width - internalWidth) / 2,
|
||||
INVENTORY_CELLS_OFFSET_Y,
|
||||
INVENTORY_CELLS_OFFSET_Y(),
|
||||
width,
|
||||
App.scr.height,
|
||||
1f,
|
||||
|
||||
@@ -42,11 +42,13 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
blendNormal(batch)
|
||||
val cellOffY = INVENTORY_CELLS_OFFSET_Y()
|
||||
|
||||
|
||||
// update map panning
|
||||
// if left click is down and cursor is in the map area
|
||||
if (Gdx.input.isButtonPressed(App.getConfigInt("config_mouseprimary")) &&
|
||||
Terrarum.mouseScreenY in INVENTORY_CELLS_OFFSET_Y..INVENTORY_CELLS_OFFSET_Y + INVENTORY_CELLS_UI_HEIGHT) {
|
||||
Terrarum.mouseScreenY in cellOffY..cellOffY + INVENTORY_CELLS_UI_HEIGHT) {
|
||||
minimapPanX += Terrarum.mouseDeltaX * 2f / minimapZoom
|
||||
minimapPanY += Terrarum.mouseDeltaY * 2f / minimapZoom
|
||||
}
|
||||
@@ -116,23 +118,23 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
batch.begin()
|
||||
|
||||
if (debugvals) {
|
||||
App.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", (width - MINIMAP_WIDTH) / 2, -10f + INVENTORY_CELLS_OFFSET_Y)
|
||||
App.fontSmallNumbers.draw(batch, "$minimapPanX, $minimapPanY; x$minimapZoom", (width - MINIMAP_WIDTH) / 2, -10f + cellOffY)
|
||||
}
|
||||
|
||||
batch.projectionMatrix = camera.combined
|
||||
// 1px stroke
|
||||
batch.color = Color.WHITE
|
||||
batch.fillRect((width - MINIMAP_WIDTH) / 2, -1 + INVENTORY_CELLS_OFFSET_Y.toFloat(), MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect((width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y + MINIMAP_HEIGHT, MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect(-1 + (width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
batch.fillRect((width - MINIMAP_WIDTH) / 2 + MINIMAP_WIDTH, INVENTORY_CELLS_OFFSET_Y.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
batch.fillRect((width - MINIMAP_WIDTH) / 2, -1 + cellOffY.toFloat(), MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect((width - MINIMAP_WIDTH) / 2, cellOffY + MINIMAP_HEIGHT, MINIMAP_WIDTH, 1f)
|
||||
batch.fillRect(-1 + (width - MINIMAP_WIDTH) / 2, cellOffY.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
batch.fillRect((width - MINIMAP_WIDTH) / 2 + MINIMAP_WIDTH, cellOffY.toFloat(), 1f, MINIMAP_HEIGHT)
|
||||
|
||||
// control hints
|
||||
batch.color = Color.WHITE
|
||||
App.fontGame.draw(batch, full.minimapControlHelp, full.offsetX, full.yEnd - 20)
|
||||
|
||||
// the minimap
|
||||
batch.draw(minimapFBO.colorBufferTexture, (width - MINIMAP_WIDTH) / 2, INVENTORY_CELLS_OFFSET_Y.toFloat())
|
||||
batch.draw(minimapFBO.colorBufferTexture, (width - MINIMAP_WIDTH) / 2, cellOffY.toFloat())
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {}
|
||||
|
||||
Reference in New Issue
Block a user