diff options
Diffstat (limited to 'GuiTest/src')
-rw-r--r-- | GuiTest/src/main/java/io/github/cottonmc/test/client/InsetsTestGui.java | 22 | ||||
-rw-r--r-- | GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java | 7 |
2 files changed, 29 insertions, 0 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/InsetsTestGui.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/InsetsTestGui.java new file mode 100644 index 0000000..abd36e6 --- /dev/null +++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/InsetsTestGui.java @@ -0,0 +1,22 @@ +package io.github.cottonmc.test.client; + +import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription; +import io.github.cottonmc.cotton.gui.widget.WButton; +import io.github.cottonmc.cotton.gui.widget.WGridPanel; + +import io.github.cottonmc.cotton.gui.widget.WLabel; + +import io.github.cottonmc.cotton.gui.widget.data.Insets; + +import net.minecraft.text.LiteralText; + +public class InsetsTestGui extends LightweightGuiDescription { + public InsetsTestGui() { + WGridPanel root = (WGridPanel) rootPanel; + + root.add(new WLabel(new LiteralText("Insets demo")), 0, 0); + root.add(new WButton(new LiteralText("Default")).setOnClick(() -> root.setInsets(Insets.ROOT_PANEL)), 0, 1, 2, 1); + root.add(new WButton(new LiteralText("None")).setOnClick(() -> root.setInsets(Insets.NONE)), 2, 1, 2, 1); + root.add(new WButton(new LiteralText("Large")).setOnClick(() -> root.setInsets(new Insets(16))), 4, 1, 2, 1); + } +} 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 b45145e..2f78fcd 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 @@ -47,6 +47,13 @@ public class LibGuiTestClient implements ClientModInitializer { }); return 0; })) + .then(literal("insets").executes(context -> { + var client = context.getSource().getClient(); + client.send(() -> { + client.openScreen(new CottonClientScreen(new InsetsTestGui())); + }); + return 0; + })) ); } |