From 9611a06a3e312855ae38eedf30bfdfecfb3598d8 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Wed, 20 May 2020 23:35:49 +0300 Subject: Add focusing support for buttons --- .../io/github/cottonmc/cotton/gui/widget/WButton.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java index 1f9525d..987f50b 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java @@ -11,6 +11,7 @@ import net.minecraft.text.Text; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; import io.github.cottonmc.cotton.gui.widget.data.Alignment; +import org.lwjgl.glfw.GLFW; public class WButton extends WWidget { private Text label; @@ -33,13 +34,18 @@ public class WButton extends WWidget { public boolean canResize() { return true; } - + + @Override + public boolean canFocus() { + return true; + } + @Override public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { boolean hovered = (mouseX>=0 && mouseY>=0 && mouseX