From ca715a8a5d904bd8903edcfcfc1515be67d03e8c Mon Sep 17 00:00:00 2001 From: Filip Weiss Date: Sat, 13 Jun 2020 17:26:51 +0200 Subject: implement a WTiledSprite widget (#62) * implement a WTiledSprite widget * tiledSprite: new constuctor, cleanup api and comments * Update GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> --- .../io/github/cottonmc/test/client/TestClientGui.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'GuiTest/src/main') diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java index b96a359..45426b4 100644 --- a/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java +++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java @@ -1,20 +1,15 @@ package io.github.cottonmc.test.client; -import java.util.ArrayList; import java.util.List; -import java.util.function.BiConsumer; import io.github.cottonmc.cotton.gui.client.BackgroundPainter; import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; -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.WListPanel; -import io.github.cottonmc.cotton.gui.widget.WPlainPanel; import io.github.cottonmc.cotton.gui.widget.WSlider; -import io.github.cottonmc.cotton.gui.widget.WSprite; import io.github.cottonmc.cotton.gui.widget.WTextField; +import io.github.cottonmc.cotton.gui.widget.WTiledSprite; import io.github.cottonmc.cotton.gui.widget.WWidget; import io.github.cottonmc.cotton.gui.widget.data.Axis; import io.github.cottonmc.cotton.gui.widget.data.Color; @@ -42,13 +37,20 @@ public class TestClientGui extends LightweightGuiDescription { public TestClientGui() { WGridPanel root = new WGridPanel(22); this.setRootPanel(root); - WLabel title = new WLabel(new LiteralText("Client Test Gui"), WLabel.DEFAULT_TEXT_COLOR) { @Override public void addTooltip(List tooltip) { tooltip.add(new LiteralText("Radical!")); } }; + WTiledSprite wood = new WTiledSprite( + 8, 8, // tile width and height + 500, // animation speed + new Identifier("minecraft:textures/block/birch_planks.png"), + new Identifier("minecraft:textures/block/dark_oak_planks.png"), + new Identifier("minecraft:textures/block/jungle_planks.png") + ); + root.add(wood, 3, 3, 2, 2); root.add(title, 0, 0); WTextField text = new WTextField(); @@ -149,4 +151,3 @@ public class TestClientGui extends LightweightGuiDescription { } } } - -- cgit