aboutsummaryrefslogtreecommitdiff
path: root/GuiTest/src
diff options
context:
space:
mode:
authorFilip Weiss <me@fiws.net>2020-06-13 17:26:51 +0200
committerGitHub <noreply@github.com>2020-06-13 18:26:51 +0300
commitca715a8a5d904bd8903edcfcfc1515be67d03e8c (patch)
tree0286e307c97ebaf46805cc271426069cce30aafd /GuiTest/src
parent7ce78ed7f294fabe2929d7217d42c9c6c1b931bc (diff)
downloadLibGui-ca715a8a5d904bd8903edcfcfc1515be67d03e8c.tar.gz
LibGui-ca715a8a5d904bd8903edcfcfc1515be67d03e8c.tar.bz2
LibGui-ca715a8a5d904bd8903edcfcfc1515be67d03e8c.zip
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>
Diffstat (limited to 'GuiTest/src')
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java17
1 files changed, 9 insertions, 8 deletions
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<Text> 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 {
}
}
}
-