aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorFalkreon <falkreon@gmail.com>2019-08-18 18:45:46 -0500
committerFalkreon <falkreon@gmail.com>2019-08-18 18:45:46 -0500
commit2705f7300fa1b87a7dcb661a26897704d70dcbd9 (patch)
treea3ece862fa2e5cd9cb964b6e3b3970f14e906876 /src/main/java
parent3640cfdcbc4fbf08a739a238fe3a52d6f8233a12 (diff)
downloadLibGui-2705f7300fa1b87a7dcb661a26897704d70dcbd9.tar.gz
LibGui-2705f7300fa1b87a7dcb661a26897704d70dcbd9.tar.bz2
LibGui-2705f7300fa1b87a7dcb661a26897704d70dcbd9.zip
Replace WToggleButton appearance, clean up config gui again
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/modmenu/ConfigGui.java3
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/modmenu/WKirbSprite.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java8
3 files changed, 6 insertions, 9 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/modmenu/ConfigGui.java b/src/main/java/io/github/cottonmc/cotton/gui/client/modmenu/ConfigGui.java
index 15c39dd..e114131 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/modmenu/ConfigGui.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/modmenu/ConfigGui.java
@@ -5,7 +5,6 @@ import io.github.cottonmc.cotton.gui.client.LibGuiClient;
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription;
import io.github.cottonmc.cotton.gui.widget.WButton;
import io.github.cottonmc.cotton.gui.widget.WGridPanel;
-import io.github.cottonmc.cotton.gui.widget.WTextField;
import io.github.cottonmc.cotton.gui.widget.WToggleButton;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
@@ -29,8 +28,6 @@ public class ConfigGui extends LightweightGuiDescription {
root.add(new WKirbSprite(), 5, 4);
- root.add(new WTextField(), 0, 3, 5, 1);
-
WButton doneButton = new WButton(new TranslatableText("gui.done"));
doneButton.setOnClick(()->{
MinecraftClient.getInstance().openScreen(previous);
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/modmenu/WKirbSprite.java b/src/main/java/io/github/cottonmc/cotton/gui/client/modmenu/WKirbSprite.java
index a51ecb5..d68b1db 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/modmenu/WKirbSprite.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/modmenu/WKirbSprite.java
@@ -10,7 +10,7 @@ import net.fabricmc.api.Environment;
import net.minecraft.util.Identifier;
public class WKirbSprite extends WWidget {
- private static final Identifier KIRB = new Identifier("libgui:widget/kirb.png");
+ private static final Identifier KIRB = new Identifier("libgui:textures/widget/kirb.png");
private static final float PX = 1f/416f;
private static final float KIRB_WIDTH = 32*PX;
@@ -98,7 +98,7 @@ public class WKirbSprite extends WWidget {
}
float offset = KIRB_WIDTH * currentFrame;
- ScreenDrawing.rect(KIRB, x, y, 32, 32, offset, 0, offset+KIRB_WIDTH, 1, 0xFFFFFFFF);
+ ScreenDrawing.rect(KIRB, x, y+8, 32, 32, offset, 0, offset+KIRB_WIDTH, 1, 0xFFFFFFFF);
long elapsed = now - lastFrame;
currentFrameTime += elapsed;
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java
index 5f1f568..846f032 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java
@@ -66,8 +66,8 @@ public class WToggleButton extends WWidget {
Text label = null;
/** Default On / Off Images */
- protected final static Identifier DEFAULT_OFF_IMAGE = new Identifier("libgui:widget/toggle_off.png");
- protected final static Identifier DEFAULT_ON_IMAGE = new Identifier("libgui:widget/toggle_on.png");
+ protected final static Identifier DEFAULT_OFF_IMAGE = new Identifier("libgui:textures/widget/toggle_off.png");
+ protected final static Identifier DEFAULT_ON_IMAGE = new Identifier("libgui:textures/widget/toggle_on.png");
protected Identifier onImage;
protected Identifier offImage;
@@ -87,11 +87,11 @@ public class WToggleButton extends WWidget {
@Override
public void paintBackground(int x, int y) {
- ScreenDrawing.rect(isOn ? DEFAULT_ON_IMAGE : DEFAULT_OFF_IMAGE, x, y, width, height, 0xFFFFFFFF);
+ ScreenDrawing.rect(isOn ? DEFAULT_ON_IMAGE : DEFAULT_OFF_IMAGE, x, y, 18, 18, 0xFFFFFFFF);
if (label!=null) {
- ScreenDrawing.drawString(label.asFormattedString(), x + 20, y+1, LibGuiClient.config.darkMode ? darkmodeColor : color);
+ ScreenDrawing.drawString(label.asFormattedString(), x + 22, y+6, LibGuiClient.config.darkMode ? darkmodeColor : color);
}
}