summaryrefslogtreecommitdiff
path: root/src/main/kotlin/gui
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-09-24 16:41:49 +0200
committerLinnea Gräf <nea@nea.moe>2024-09-24 16:41:49 +0200
commitaa1238430bd0f103f040ed31baadc029bb09529e (patch)
tree05aa9d4f6a1c35166003dc8e306dd2c40a818945 /src/main/kotlin/gui
parentfb40ab45f0b4979420bae066da2244f4fdd52db8 (diff)
downloadultra-notifier-aa1238430bd0f103f040ed31baadc029bb09529e.tar.gz
ultra-notifier-aa1238430bd0f103f040ed31baadc029bb09529e.tar.bz2
ultra-notifier-aa1238430bd0f103f040ed31baadc029bb09529e.zip
snapshot
Diffstat (limited to 'src/main/kotlin/gui')
-rw-r--r--src/main/kotlin/gui/BaseScreen.kt52
-rw-r--r--src/main/kotlin/gui/MessageUi.kt27
-rw-r--r--src/main/kotlin/gui/ScreenUtil.kt19
3 files changed, 44 insertions, 54 deletions
diff --git a/src/main/kotlin/gui/BaseScreen.kt b/src/main/kotlin/gui/BaseScreen.kt
deleted file mode 100644
index 06aafb9..0000000
--- a/src/main/kotlin/gui/BaseScreen.kt
+++ /dev/null
@@ -1,52 +0,0 @@
-package moe.nea.ultranotifier.gui
-
-import net.minecraft.client.gui.DrawContext
-import net.minecraft.client.gui.screen.Screen
-import net.minecraft.text.Text
-//#if MC < 1.20.4
-//$$import com.mojang.blaze3d.platform.GlStateManager
-//#endif
-
-class DrawingContext(
-//#if MC > 1.20.4
- val vanilla: DrawContext,
-//#endif
-) {
- fun pushMatrix() {
-//#if MC > 1.20.4
- vanilla.matrices.push()
-//#else
-//$$ GlStateManager.pushMatrix()
-//#endif
- }
- fun popMatrix() {
-//#if MC > 1.20.4
- vanilla.matrices.pop()
-//#else
-//$$ GlStateManager.popMatrix()
-//#endif
- }
- fun translate(x: Double, y: Double, z: Double) {
-//#if MC > 1.20.4
- vanilla.matrices.translate(x, y, z)
-//#else
-//$$ GlStateManager.translate(x, y, z)
-//#endif
- }
- fun scale(x: Float, y: Float, z: Float) {
-//#if MC > 1.20.4
- vanilla.matrices.scale(x, y, z)
-//#else
-//$$ GlStateManager.scale(x, y, z)
-//#endif
- }
-
-}
-
-abstract class BaseScreen(title: Text) : Screen(
-//#if MC >= 11400
- title
-//#endif
-) {
-
-}
diff --git a/src/main/kotlin/gui/MessageUi.kt b/src/main/kotlin/gui/MessageUi.kt
index 78965b3..f4012da 100644
--- a/src/main/kotlin/gui/MessageUi.kt
+++ b/src/main/kotlin/gui/MessageUi.kt
@@ -1,6 +1,29 @@
package moe.nea.ultranotifier.gui
-import moe.nea.ultranotifier.commands.literalText
+import gg.essential.universal.UGraphics
+import gg.essential.universal.UMatrixStack
+import gg.essential.universal.UScreen
+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)
+ }
+
+ 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()
+ }
-class MessageUi : BaseScreen(literalText("Messages")) {
}
diff --git a/src/main/kotlin/gui/ScreenUtil.kt b/src/main/kotlin/gui/ScreenUtil.kt
new file mode 100644
index 0000000..bb3dfc3
--- /dev/null
+++ b/src/main/kotlin/gui/ScreenUtil.kt
@@ -0,0 +1,19 @@
+package moe.nea.ultranotifier.gui
+
+import gg.essential.universal.UScreen
+import moe.nea.ultranotifier.event.SubscriptionTarget
+import moe.nea.ultranotifier.event.TickEvent
+import moe.nea.ultranotifier.event.UltraSubscribe
+import net.minecraft.client.gui.screen.Screen
+
+object ScreenUtil : SubscriptionTarget {
+ var openScreen: Screen? = null
+
+ @UltraSubscribe
+ fun onTick(event: TickEvent) {
+ openScreen?.let {
+ UScreen.displayScreen(it)
+ openScreen = null
+ }
+ }
+}