From 336da6cb9ff32a8d1cd7b07cdff9b9495cbd2395 Mon Sep 17 00:00:00 2001 From: kurrycat Date: Wed, 12 Jul 2023 00:17:03 +0200 Subject: [PATCH] fixed text being offset by 1px --- .../kurrycat/mpkmod/compatibility/MCClasses/Renderer2D.java | 1 + .../java/io/github/kurrycat/mpkmod/gui/components/Button.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Renderer2D.java b/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Renderer2D.java index 4513e7b..cd137f9 100644 --- a/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Renderer2D.java +++ b/common/src/main/java/io/github/kurrycat/mpkmod/compatibility/MCClasses/Renderer2D.java @@ -98,6 +98,7 @@ public static void drawLines(Collection points, Color color) { renderer.ifPresent(renderer2DInterface -> renderer2DInterface.drawLines(points, color)); } + //TODO: fix scissor inside each other public static void enableScissor(double x, double y, double w, double h) { Optional renderer = Interface.get(); renderer.ifPresent(renderer2DInterface -> renderer2DInterface.enableScissor(x, y, w, h)); diff --git a/common/src/main/java/io/github/kurrycat/mpkmod/gui/components/Button.java b/common/src/main/java/io/github/kurrycat/mpkmod/gui/components/Button.java index e959b8f..2f61fe3 100644 --- a/common/src/main/java/io/github/kurrycat/mpkmod/gui/components/Button.java +++ b/common/src/main/java/io/github/kurrycat/mpkmod/gui/components/Button.java @@ -69,8 +69,8 @@ public void render(Vector2D mouse) { this.getText(), getDisplayedPos() .add(getDisplayedSize().div(2)) - .add(new Vector2D(0.5, this.getText().toLowerCase().equals(this.getText()) ? 0 : 1)) - .add(textOffset), + .add(new Vector2D(0.5D, this.getText().toLowerCase().equals(this.getText()) ? 0 : 1)) + .add(textOffset).round(), !enabled ? disabledTextColor : isBeingPressed ? pressedTextColor : textColor,