From 9c22bd4d7f23256f97175cdeb1412505f56d2e73 Mon Sep 17 00:00:00 2001 From: nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> Date: Sat, 30 Apr 2022 10:51:45 +0100 Subject: fix scissoring (not sus) --- src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java | 1 - .../java/io/polyfrost/oneconfig/gui/elements/TextInputField.java | 5 ----- .../java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java | 2 -- .../io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java | 5 ----- .../io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java | 2 -- src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java | 2 -- 6 files changed, 17 deletions(-) (limited to 'src/main') diff --git a/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java index 8a39c38..ae8d796 100644 --- a/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java +++ b/src/main/java/io/polyfrost/oneconfig/gui/OneConfigGui.java @@ -18,7 +18,6 @@ import static org.lwjgl.nanovg.NanoVG.nvgScissor; public class OneConfigGui extends GuiScreen { public static OneConfigGui INSTANCE; - private final BasicElement element = new BasicElement(200, 200, 1, true); public final int x = 320; public final int y = 140; diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java index d5dcfdd..8f7f77c 100644 --- a/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java @@ -14,9 +14,6 @@ import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; -import static org.lwjgl.nanovg.NanoVG.nvgResetScissor; -import static org.lwjgl.nanovg.NanoVG.nvgScissor; - public class TextInputField extends BasicElement { protected final String defaultText; @@ -78,7 +75,6 @@ public class TextInputField extends BasicElement { } width = RenderManager.getTextWidth(vg, s.substring(0, caretPos), 14f, Fonts.INTER_REGULAR); } - nvgScissor(vg, x, y, this.width, height); if(hovered) { while (Mouse.next()) { if (Mouse.getEventButtonState()) { @@ -139,7 +135,6 @@ public class TextInputField extends BasicElement { } else { RenderManager.drawString(vg, s.toString(), x + 12, y + height / 2f + 1, color, 14f, Fonts.INTER_REGULAR); } - nvgResetScissor(vg); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java index 65be59f..569d799 100644 --- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java @@ -27,7 +27,6 @@ public class ConfigPage extends BasicOption { @Override public void draw(long vg, int x, int y) { int height = description.equals("") ? 64 : 96; - NanoVG.nvgScissor(vg, x - 16, y, 1024, height); boolean hovered = InputUtils.isAreaHovered(x - 2, y, 1024, height); boolean clicked = InputUtils.isAreaClicked(x - 2, y, 1024, height); backgroundColor = ColorUtils.smoothColor(backgroundColor, OneConfigConfig.GRAY_500, OneConfigConfig.GRAY_400, hovered, 100); @@ -42,7 +41,6 @@ public class ConfigPage extends BasicOption { if (clicked) OneConfigGui.INSTANCE.openPage(new ModConfigPage(page)); NanoVG.nvgGlobalAlpha(vg, 1f); - NanoVG.nvgResetScissor(vg); } @Override diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java index 5a4288b..581257b 100644 --- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java @@ -10,9 +10,6 @@ import io.polyfrost.oneconfig.utils.MathUtils; import java.lang.reflect.Field; -import static org.lwjgl.nanovg.NanoVG.nvgResetScissor; -import static org.lwjgl.nanovg.NanoVG.nvgScissor; - public class ConfigSwitch extends BasicOption { private int color; private float percentOn = 0f; @@ -29,7 +26,6 @@ public class ConfigSwitch extends BasicOption { toggled = (boolean) get(); } catch (IllegalAccessException ignored) { } - nvgScissor(vg, x, y, size == 1 ? 480 : 992, 32); int x2 = x + 19 + (int) (percentOn * 18); color = ColorUtils.smoothColor(color, OneConfigConfig.GRAY_400, OneConfigConfig.BLUE_500, toggled, 20f); if (color == -15123643) { @@ -49,7 +45,6 @@ public class ConfigSwitch extends BasicOption { } } percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 10)); - nvgResetScissor(vg); } @Override diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java index 4d44701..8d6179c 100644 --- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java @@ -30,9 +30,7 @@ public class ConfigTextBox extends BasicOption { @Override public void draw(long vg, int x, int y) { - NanoVG.nvgScissor(vg, x, y, size == 1 && !secure && !multiLine ? 216 : 344, 32); RenderManager.drawString(vg, name, x, y + 16, OneConfigConfig.WHITE, 14, Fonts.INTER_MEDIUM); - NanoVG.nvgResetScissor(vg); textField.draw(vg, x + (size == 1 && hasHalfSize() ? 224 : 352), y); diff --git a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java index 9d5dd6e..a1bb5cc 100644 --- a/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java +++ b/src/main/java/io/polyfrost/oneconfig/gui/pages/ModConfigPage.java @@ -18,7 +18,6 @@ public class ModConfigPage extends Page { @Override public void draw(long vg, int x, int y) { if (page.categories.size() == 0) return; - NanoVG.nvgScissor(vg, x + 14, y, 1056, 800); String selectedCategory = page.categories.keySet().stream().findFirst().get(); int optionX = x + 30; int optionY = y + (page.categories.size() == 1 ? 32 : 72); @@ -58,7 +57,6 @@ public class ModConfigPage extends Page { } optionY += 28; } - NanoVG.nvgResetScissor(vg); } @Override -- cgit