Merge pull request #10 from GTNewHorizons/large-gui

fix button overlap on messages
This commit is contained in:
Martin Robertz authored and GitHub committed 2022-09-09 13:47:33 +02:00
commit 365027a21f
4 files changed
+24 -19

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
// Add your dependencies here
dependencies {
compile 'com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-84-GTNH:dev'
compile 'com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-104-GTNH:dev'
compile 'com.github.GTNewHorizons:Forgelin:1.9.2-GTNH-1.7.10-Edition'
compile 'com.github.GTNewHorizons:BuildCraft:7.1.27:dev'
}
@@ -12,26 +12,21 @@ import com.projecturanus.betterp2p.item.BetterMemoryCardModes
import com.projecturanus.betterp2p.network.*
import net.minecraft.client.gui.GuiButton
import net.minecraft.client.gui.GuiScreen
import net.minecraft.client.renderer.Tessellator
import net.minecraft.client.resources.I18n
import net.minecraft.util.ResourceLocation
import org.lwjgl.input.Mouse
import java.util.*
class GuiAdvancedMemoryCard(msg: S2CListP2P) : GuiScreen(), TextureBound {
private val outputColor = 0x4566ccff
private val selectedColor = 0x4545DA75
private val errorColor = 0x45DA4527
private val inactiveColor = 0x45FFEA05
private val xSize = 238
private val xSize = 288
private val ySize = 206
private val guiLeft: Int by lazy { (width - this.xSize) / 2 }
private val guiTop: Int by lazy { (height - this.ySize) / 2 }
private val tableX = 9
private val tableY = 19
private val rowWidth = 203
private val rowHeight = 22
private var selectedIndex = -1
@@ -55,7 +50,7 @@ class GuiAdvancedMemoryCard(msg: S2CListP2P) : GuiScreen(), TextureBound {
private var mode = msg.memoryInfo.mode
private var modeString = getModeString()
private val modeButton by lazy { GuiButton(0, guiLeft + 8, guiTop + 154, 205, 20, modeString) }
private val modeButton by lazy { GuiButton(0, guiLeft + 8, guiTop + 154, 256, 20, modeString) }
init {
selectInfo(msg.memoryInfo.selectedIndex)
@@ -75,9 +70,9 @@ class GuiAdvancedMemoryCard(msg: S2CListP2P) : GuiScreen(), TextureBound {
scrollBar = WidgetScrollBar()
searchBar = MEGuiTextField(65, 10)
searchBar.setMaxStringLength(25)
searchBar.x = guiLeft + 148
searchBar.x = guiLeft + 198
searchBar.y = guiTop + 5
scrollBar.displayX = guiLeft + 218
scrollBar.displayX = guiLeft + 268
scrollBar.displayY = guiTop + 19
scrollBar.height = 114
scrollBar.setRange(0, infos.size.coerceIn(0..(infos.size - 4).coerceAtLeast(0)), 23)
@@ -282,7 +277,17 @@ class GuiAdvancedMemoryCard(msg: S2CListP2P) : GuiScreen(), TextureBound {
private fun drawBackground() {
bindTexture(MODID, "textures/gui/advanced_memory_card.png")
drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize)
val tessellator = Tessellator.instance
val f = 1f / this.xSize.toFloat()
val f1 = 1f / this.ySize.toFloat()
val u = 0
val v = 0
tessellator.startDrawingQuads()
tessellator.addVertexWithUV(guiLeft.toDouble(), (guiTop + this.ySize).toDouble(), 0.0, (u.toFloat() * f).toDouble(), ((v + this.ySize).toFloat() * f1).toDouble())
tessellator.addVertexWithUV(((guiLeft + this.xSize).toDouble()), ((guiTop + this.ySize).toDouble()), 0.0, ((u + this.xSize).toFloat() * f).toDouble(), ((v + this.ySize).toFloat() * f1).toDouble())
tessellator.addVertexWithUV((guiLeft + this.xSize).toDouble(), guiTop.toDouble(), 0.0, ((u + this.xSize).toFloat() * f).toDouble(), (v.toFloat() * f1).toDouble())
tessellator.addVertexWithUV(guiLeft.toDouble(), guiTop.toDouble(), 0.0, (u.toFloat() * f).toDouble(), (v.toFloat() * f1).toDouble())
tessellator.draw()
}
override fun doesGuiPauseGame(): Boolean {
@@ -13,7 +13,7 @@ class WidgetP2PDevice(private val selectedInfoProperty: KMutableProperty0<InfoWr
private val errorColor = 0x45DA4527
private val inactiveColor = 0x45FFEA05
private val rowWidth = 203
private val rowWidth = 254
private val rowHeight = 32
private var selectedInfo: InfoWrapper?
@@ -86,8 +86,8 @@ class WidgetP2PDevice(private val selectedInfoProperty: KMutableProperty0<InfoWr
info.bindButton.enabled = false
info.selectButton.enabled = true
info.selectButton.xPosition = x + 172
info.selectButton.width = 28
info.selectButton.xPosition = x + 215
info.selectButton.width = 32
info.selectButton.yPosition = y + 6
info.selectButton.drawButton(gui.mc, mouseX, mouseY)
} else if (info.bindButton.enabled && info.selectButton.enabled) {
@@ -95,14 +95,14 @@ class WidgetP2PDevice(private val selectedInfoProperty: KMutableProperty0<InfoWr
info.selectButton.enabled = true
// Select button on the left
info.selectButton.xPosition = x + 141
info.selectButton.width = 28
info.selectButton.xPosition = x + 178
info.selectButton.width = 32
info.selectButton.yPosition = y + 6
info.selectButton.drawButton(gui.mc, mouseX, mouseY)
// Bind button on the right
info.bindButton.xPosition = x + 172
info.bindButton.width = 28
info.bindButton.xPosition = x + 215
info.bindButton.width = 32
info.bindButton.yPosition = y + 6
info.bindButton.drawButton(gui.mc, mouseX, mouseY)
} else if (!info.selectButton.enabled && !info.bindButton.enabled) {
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB