diff options
author | xander <xander@isxander.dev> | 2022-09-10 13:45:27 +0100 |
---|---|---|
committer | xander <xander@isxander.dev> | 2022-09-10 19:09:09 +0100 |
commit | aa98d07d08c738e32f7804d2d139eb3cdeb6bddb (patch) | |
tree | cfe33752f42a5b857a4e510c1cf270b911c97b93 /src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java | |
parent | c72f2d573ba425871642f2c5b98e7630c10c30fd (diff) | |
download | YetAnotherConfigLib-aa98d07d08c738e32f7804d2d139eb3cdeb6bddb.tar.gz YetAnotherConfigLib-aa98d07d08c738e32f7804d2d139eb3cdeb6bddb.tar.bz2 YetAnotherConfigLib-aa98d07d08c738e32f7804d2d139eb3cdeb6bddb.zip |
improve expand minimize button in option groups
Diffstat (limited to 'src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java')
-rw-r--r-- | src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java b/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java new file mode 100644 index 0000000..240cfb2 --- /dev/null +++ b/src/main/java/dev/isxander/yacl/gui/LowProfileButtonWidget.java @@ -0,0 +1,27 @@ +package dev.isxander.yacl.gui; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.widget.ButtonWidget; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.text.Text; +import net.minecraft.util.math.MathHelper; + +public class LowProfileButtonWidget extends ButtonWidget { + public LowProfileButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress) { + super(x, y, width, height, message, onPress); + } + + public LowProfileButtonWidget(int x, int y, int width, int height, Text message, PressAction onPress, TooltipSupplier tooltipSupplier) { + super(x, y, width, height, message, onPress, tooltipSupplier); + } + + @Override + public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta) { + if (!isHovered()) { + int j = this.active ? 0xFFFFFF : 0xA0A0A0; + drawCenteredText(matrices, MinecraftClient.getInstance().textRenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24); + } else { + super.renderButton(matrices, mouseX, mouseY, delta); + } + } +} |