From 9ddc57b0db03fa7afabf23bb7ee490a5c84af393 Mon Sep 17 00:00:00 2001 From: Alexander Haas Date: Thu, 13 Oct 2022 08:08:50 +0200 Subject: IconInsets for WButton Icon (#175) * added iconInsets for WButton * fixed some pull request comments * minor code cleanup * more code cleanup * changed intelliJ config to be able to save lines with whitespace * Update src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> --- GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'GuiTest/src/main/java/io') diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java b/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java index 6c74e28..39b09d6 100644 --- a/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java +++ b/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java @@ -15,6 +15,7 @@ import io.github.cottonmc.cotton.gui.widget.WGridPanel; import io.github.cottonmc.cotton.gui.widget.WItemSlot; import io.github.cottonmc.cotton.gui.widget.WLabel; import io.github.cottonmc.cotton.gui.widget.WTextField; +import io.github.cottonmc.cotton.gui.widget.data.Texture; import io.github.cottonmc.cotton.gui.widget.icon.TextureIcon; public class TestDescription extends SyncedGuiDescription { @@ -42,7 +43,8 @@ public class TestDescription extends SyncedGuiDescription { buttonB.setOnClick(() -> slot.setIcon(new TextureIcon(new Identifier("libgui-test", "saddle.png")))); root.add(buttonB, 5, 3, 4, 1); - root.add(new WButton(Text.literal("Button C")), 0, 5, 4, 1); + TextureIcon testIcon = new TextureIcon(new Texture(new Identifier("libgui-test", "icon.png"))); + root.add(new WButton(testIcon, Text.literal("Button C")), 0, 5, 4, 1); root.add(new WButton(Text.literal("Button D")), 5, 5, 4, 1); root.add(new WTextField(Text.literal("Type something...")).setMaxLength(64), 0, 7, 5, 1); -- cgit