From 5aa969979ab1dd0e64e5b569cc3b7b281b3e536f Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sat, 19 Oct 2024 18:20:55 +0200 Subject: Fix tick event and texture rendering --- src/main/kotlin/gui/MessageUi.kt | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'src/main/kotlin/gui') diff --git a/src/main/kotlin/gui/MessageUi.kt b/src/main/kotlin/gui/MessageUi.kt index f4012da..f3feeb7 100644 --- a/src/main/kotlin/gui/MessageUi.kt +++ b/src/main/kotlin/gui/MessageUi.kt @@ -1,29 +1,19 @@ package moe.nea.ultranotifier.gui -import gg.essential.universal.UGraphics import gg.essential.universal.UMatrixStack import gg.essential.universal.UScreen +import moe.nea.ultranotifier.util.render.ScreenRenderUtils +import moe.nea.ultranotifier.util.ultraIdentifier import java.awt.Color class MessageUi : UScreen() { override fun onDrawScreen(matrixStack: UMatrixStack, mouseX: Int, mouseY: Int, partialTicks: Float) { super.onDrawScreen(matrixStack, mouseX, mouseY, partialTicks) - fillRect(matrixStack, - 0.0, 0.0, width.toDouble(), height.toDouble(), Color.RED) + ScreenRenderUtils.fillRect(matrixStack, 0.0, 0.0, width.toDouble(), height.toDouble(), Color.RED) + ScreenRenderUtils.renderTexture( + ultraIdentifier("textures/gui/square_panel.png"), + matrixStack, + 200.0, 0.0, 300.0, 100.0 + ) } - - fun fillRect( - matrixStack: UMatrixStack, - left: Double, top: Double, right: Double, bottom: Double, - color: Color, - ) { - val buffer = UGraphics.getFromTessellator() - buffer.beginWithDefaultShader(UGraphics.DrawMode.QUADS, UGraphics.CommonVertexFormats.POSITION_COLOR) - buffer.pos(matrixStack, left, top, 0.0).color(color).endVertex() - buffer.pos(matrixStack, left, bottom, 0.0).color(color).endVertex() - buffer.pos(matrixStack, right, bottom, 0.0).color(color).endVertex() - buffer.pos(matrixStack, right, top, 0.0).color(color).endVertex() - buffer.drawDirect() - } - } -- cgit