aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-03-19 20:36:13 +0200
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-03-19 20:36:13 +0200
commit9c6c978cc6938114e0dffdabe6bd1d2367228992 (patch)
tree12fc18b106449ad3a57630c52951e5fefea8737c
parent3ad84bbe784bf69b70fe793574f1e93fb263d34b (diff)
downloadLibGui-9c6c978cc6938114e0dffdabe6bd1d2367228992.tar.gz
LibGui-9c6c978cc6938114e0dffdabe6bd1d2367228992.tar.bz2
LibGui-9c6c978cc6938114e0dffdabe6bd1d2367228992.zip
Remove experimental WTitle widget
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WTitle.java101
-rw-r--r--src/main/resources/assets/libgui/textures/widget/title_dark.pngbin1630 -> 0 bytes
-rw-r--r--src/main/resources/assets/libgui/textures/widget/title_light.pngbin1587 -> 0 bytes
3 files changed, 0 insertions, 101 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTitle.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTitle.java
deleted file mode 100644
index 2b52caf..0000000
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTitle.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package io.github.cottonmc.cotton.gui.widget;
-
-import com.google.common.annotations.Beta;
-import io.github.cottonmc.cotton.gui.client.BackgroundPainter;
-import io.github.cottonmc.cotton.gui.client.NinePatch;
-import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
-import io.github.cottonmc.cotton.gui.widget.data.Alignment;
-import net.fabricmc.api.EnvType;
-import net.fabricmc.api.Environment;
-import net.minecraft.text.Text;
-import net.minecraft.util.Identifier;
-
-import javax.annotation.Nullable;
-
-/**
- * A panel title widget with a 3D effect.
- *
- * <p><img src="https://raw.githubusercontent.com/CottonMC/docs/master/images/libgui_title.png" alt="Screenshot of a title widget">
- *
- * <p>Titles should be added to their panels at (0, 0) and they should be as wide as the panel.
- * The default title painter assumes that the containing panel uses {@link BackgroundPainter#VANILLA} or
- * a {@linkplain NinePatch nine-patch background painter} with a padding of 8.
- *
- * <p>This widget is experimental and may be removed in a future release of LibGui.
- */
-@Beta
-public class WTitle extends WWidget {
- public static final BackgroundPainter DEFAULT_BACKGROUND_PAINTER =
- BackgroundPainter.createLightDarkVariants(
- BackgroundPainter.createNinePatch(new Identifier("libgui", "textures/widget/title_light.png"), 8).setBottomPadding(0),
- BackgroundPainter.createNinePatch(new Identifier("libgui", "textures/widget/title_dark.png"), 8).setBottomPadding(0)
- );
-
- private Text label;
- private Alignment alignment = Alignment.CENTER;
- private int color = 0xFFFFFF;
-
- @Environment(EnvType.CLIENT)
- @Nullable
- private BackgroundPainter backgroundPainter = DEFAULT_BACKGROUND_PAINTER;
-
- public WTitle(Text label) {
- this.label = label;
- }
-
- @Override
- public boolean canResize() {
- return true;
- }
-
- @Override
- public void setSize(int x, int y) {
- super.setSize(x, 16);
- }
-
- @Environment(EnvType.CLIENT)
- @Nullable
- public BackgroundPainter getBackgroundPainter() {
- return backgroundPainter;
- }
-
- @Environment(EnvType.CLIENT)
- public WTitle setBackgroundPainter(@Nullable BackgroundPainter backgroundPainter) {
- this.backgroundPainter = backgroundPainter;
- return this;
- }
-
- public Text getLabel() {
- return label;
- }
-
- public WTitle setLabel(Text label) {
- this.label = label;
- return this;
- }
-
- public int getColor() {
- return color;
- }
-
- public WTitle setColor(int color) {
- this.color = color;
- return this;
- }
-
- public Alignment getAlignment() {
- return alignment;
- }
-
- public WTitle setAlignment(Alignment alignment) {
- this.alignment = alignment;
- return this;
- }
-
- @Override
- public void paintBackground(int x, int y, int mouseX, int mouseY) {
- if (backgroundPainter != null) backgroundPainter.paintBackground(x, y, this);
-
- ScreenDrawing.drawStringWithShadow(label.asFormattedString(), alignment, x, y, getWidth(), color);
- }
-}
diff --git a/src/main/resources/assets/libgui/textures/widget/title_dark.png b/src/main/resources/assets/libgui/textures/widget/title_dark.png
deleted file mode 100644
index 0548651..0000000
--- a/src/main/resources/assets/libgui/textures/widget/title_dark.png
+++ /dev/null
Binary files differ
diff --git a/src/main/resources/assets/libgui/textures/widget/title_light.png b/src/main/resources/assets/libgui/textures/widget/title_light.png
deleted file mode 100644
index 22bf614..0000000
--- a/src/main/resources/assets/libgui/textures/widget/title_light.png
+++ /dev/null
Binary files differ