aboutsummaryrefslogtreecommitdiff
path: root/GuiTest
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-10-24 10:57:49 +0300
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-10-24 10:57:49 +0300
commitb8add1552717ec7a8079da18cecb9439c2be0f1a (patch)
tree9b50525db036a999315b5e32946b1c8ce9e071c7 /GuiTest
parent7b5dc61066c75dc1a4531f11b681fc51550e0dc1 (diff)
downloadLibGui-b8add1552717ec7a8079da18cecb9439c2be0f1a.tar.gz
LibGui-b8add1552717ec7a8079da18cecb9439c2be0f1a.tar.bz2
LibGui-b8add1552717ec7a8079da18cecb9439c2be0f1a.zip
Add simple HUD test
Diffstat (limited to 'GuiTest')
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java3
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/WHudTest.java26
2 files changed, 29 insertions, 0 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
index 5ef61c2..65efe75 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
@@ -1,5 +1,6 @@
package io.github.cottonmc.test.client;
+import io.github.cottonmc.cotton.gui.client.CottonHud;
import io.github.cottonmc.cotton.gui.client.CottonInventoryScreen;
import io.github.cottonmc.test.LibGuiTest;
import io.github.cottonmc.test.TestDescription;
@@ -14,6 +15,8 @@ public class LibGuiTestClient implements ClientModInitializer {
LibGuiTest.GUI_SCREEN_HANDLER_TYPE,
(desc, inventory, title) -> new CottonInventoryScreen<>(desc, inventory.player, title)
);
+
+ CottonHud.INSTANCE.add(new WHudTest(), 10, -20, 10, 10);
}
}
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/WHudTest.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/WHudTest.java
new file mode 100644
index 0000000..2cc1e4b
--- /dev/null
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/WHudTest.java
@@ -0,0 +1,26 @@
+package io.github.cottonmc.test.client;
+
+import net.fabricmc.api.EnvType;
+import net.fabricmc.api.Environment;
+
+import net.minecraft.client.util.math.MatrixStack;
+
+import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
+import io.github.cottonmc.cotton.gui.widget.WWidget;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+@Environment(EnvType.CLIENT)
+public class WHudTest extends WWidget {
+ private static final Logger LOGGER = LogManager.getLogger();
+
+ @Override
+ public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) {
+ ScreenDrawing.coloredRect(x, y, width, height, 0xFF_00FF00);
+ }
+
+ @Override
+ public void tick() {
+ LOGGER.debug("tick!");
+ }
+}