From bcef08119527b216dbe4fd143e28a7b1b0d396d3 Mon Sep 17 00:00:00 2001
From: ThisIsALegitUsername
<73719631+ThisIsALegitUsername@users.noreply.github.com>
Date: Sun, 9 Apr 2023 08:14:10 -0600
Subject: [PATCH] better boolean settings
---
desktopRuntime/eclipseProject/.project | 6 +--
.../eaglercraftDebugRuntime.launch | 6 +--
.../ui/clickgui/rewrite/ClickGuiRewrite.java | 46 +++++++++++--------
.../clickgui/rewrite/comp/impl/CompMode.java | 26 +++++++++++
4 files changed, 59 insertions(+), 25 deletions(-)
create mode 100644 src/main/java/dev/resent/visual/ui/clickgui/rewrite/comp/impl/CompMode.java
diff --git a/desktopRuntime/eclipseProject/.project b/desktopRuntime/eclipseProject/.project
index 2a8a8250..895119e4 100644
--- a/desktopRuntime/eclipseProject/.project
+++ b/desktopRuntime/eclipseProject/.project
@@ -1,6 +1,6 @@
- eclipseProject
+ Resent 1.8
@@ -18,12 +18,12 @@
src_lwjgl_java
2
- C:/Users/kay_j/Downloads/uwu/Resent-1.8/src/lwjgl/java
+ C:/Users/kay_j/Downloads/uwu/Resent-1.8/src/lwjgl/java/
src_main_java
2
- C:/Users/kay_j/Downloads/uwu/Resent-1.8/src/main/java
+ C:/Users/kay_j/Downloads/uwu/Resent-1.8/src/main/java/
diff --git a/desktopRuntime/eclipseProject/eaglercraftDebugRuntime.launch b/desktopRuntime/eclipseProject/eaglercraftDebugRuntime.launch
index 4e928681..a2d024f0 100644
--- a/desktopRuntime/eclipseProject/eaglercraftDebugRuntime.launch
+++ b/desktopRuntime/eclipseProject/eaglercraftDebugRuntime.launch
@@ -2,7 +2,7 @@
-
+
@@ -17,8 +17,8 @@
-
-
+
+
diff --git a/src/main/java/dev/resent/visual/ui/clickgui/rewrite/ClickGuiRewrite.java b/src/main/java/dev/resent/visual/ui/clickgui/rewrite/ClickGuiRewrite.java
index c63e1b53..b3d6107d 100644
--- a/src/main/java/dev/resent/visual/ui/clickgui/rewrite/ClickGuiRewrite.java
+++ b/src/main/java/dev/resent/visual/ui/clickgui/rewrite/ClickGuiRewrite.java
@@ -3,6 +3,7 @@ package dev.resent.visual.ui.clickgui.rewrite;
import dev.resent.client.Resent;
import dev.resent.module.base.Mod;
import dev.resent.module.base.setting.BooleanSetting;
+import dev.resent.module.base.setting.ModeSetting;
import dev.resent.module.base.setting.Setting;
import dev.resent.util.misc.GlUtils;
import dev.resent.util.render.Color;
@@ -13,6 +14,8 @@ import dev.resent.visual.ui.animation.Direction;
import dev.resent.visual.ui.animation.SimpleAnimation;
import dev.resent.visual.ui.clickgui.rewrite.comp.Comp;
import dev.resent.visual.ui.clickgui.rewrite.comp.impl.CompCheck;
+import dev.resent.visual.ui.clickgui.rewrite.comp.impl.CompMode;
+
import java.io.IOException;
import java.util.ArrayList;
import net.lax1dude.eaglercraft.v1_8.Mouse;
@@ -144,8 +147,8 @@ public class ClickGuiRewrite extends GuiScreen {
/* !------------- SETTINGS ----------------! */
if (selectedMod != null) {
- fr.drawString("<", x+80, y+115+offset, -1, false);
- RenderUtils.drawRoundedRect(x+80, y+125, x+width-20, y+325, 16, secondaryColor);
+ RenderUtils.drawRoundedRect(x+80, y+105, x+width-20, y+390, 16, secondaryColor);
+ fr.drawString("<", x+90, y+115+offset, -1, false);
for (Comp comp : comps) {
comp.drawScreen(mouseX, mouseY);
@@ -194,28 +197,14 @@ public class ClickGuiRewrite extends GuiScreen {
if (isMouseInside(mouseX, mouseY, x+width-60, y+140+offset+scrollOffset, x+width-40, y+160+offset+scrollOffset) && mouseButton == 0 && m.doesHaveSetting()) {
selectedMod = m;
- int settingOffset = 0;
- for (Setting s : selectedMod.settings) {
- if (s instanceof BooleanSetting) {
- comps.add(new CompCheck(x+110, y+125+settingOffset, selectedMod, s));
- }
-
- settingOffset += 25;
- }
+ drawSetting();
}
if (isMouseInside(mouseX, mouseY, x+80, y+125+offset+scrollOffset, x+width-20, y+175+offset+scrollOffset)) {
if (mouseButton == 1 && m.doesHaveSetting()) {
selectedMod = m;
- int settingOffset = 0;
- for (Setting s : selectedMod.settings) {
- if (s instanceof BooleanSetting) {
- comps.add(new CompCheck(x+110, y+125+settingOffset, selectedMod, s));
- }
-
- settingOffset += 25;
- }
+ drawSetting();
}
if (mouseButton == 0 && selectedMod == null) {
@@ -228,7 +217,7 @@ public class ClickGuiRewrite extends GuiScreen {
}
if (selectedMod != null) {
- if (isMouseInside(mouseX, mouseY, x+77, y+112, x+87, y+125)) {
+ if (isMouseInside(mouseX, mouseY, x+87, y+112, x+97, y+125)) {
selectedMod = null;
comps.clear();
}
@@ -296,4 +285,23 @@ public class ClickGuiRewrite extends GuiScreen {
public void onGuiClosed() {
mc.gameSettings.saveOptions();
}
+
+ public void drawSetting() {
+ int settingYOffset = 0;
+ int settingXOffset = 0;
+ for (Setting s : selectedMod.settings) {
+ if (s instanceof BooleanSetting) {
+ comps.add(new CompCheck(x+110+settingXOffset, y+125+settingYOffset, selectedMod, s));
+ }
+ if(s instanceof ModeSetting) {
+ comps.add(new CompMode(x+110+settingXOffset, y+125+settingYOffset, selectedMod, s));
+ }
+
+ if(x+160+settingXOffset+fr.getStringWidth(s.name)*2 > x+width-20) {
+ settingXOffset = 0;
+ settingYOffset += 25;
+ }else
+ settingXOffset += fr.getStringWidth(s.name)+50;
+ }
+ }
}
diff --git a/src/main/java/dev/resent/visual/ui/clickgui/rewrite/comp/impl/CompMode.java b/src/main/java/dev/resent/visual/ui/clickgui/rewrite/comp/impl/CompMode.java
new file mode 100644
index 00000000..66686c21
--- /dev/null
+++ b/src/main/java/dev/resent/visual/ui/clickgui/rewrite/comp/impl/CompMode.java
@@ -0,0 +1,26 @@
+package dev.resent.visual.ui.clickgui.rewrite.comp.impl;
+
+import dev.resent.module.base.Mod;
+import dev.resent.module.base.setting.Setting;
+import dev.resent.visual.ui.clickgui.rewrite.comp.Comp;
+
+public class CompMode extends Comp{
+
+ public CompMode(float x, float y, Mod m, Setting s) {
+ this.x = x;
+ this.y = y;
+ this.mod = m;
+ this.setting = s;
+ }
+
+ @Override
+ public void mouseClicked(int mouseX, int mouseY, int mouseButton) {
+
+ }
+
+ @Override
+ public void drawScreen(int mouseX, int mouseY) {
+
+ }
+
+}