better boolean settings

This commit is contained in:
ThisIsALegitUsername 2023-04-09 08:14:10 -06:00
parent 1f5ba6cdee
commit bcef081195
4 changed files with 59 additions and 25 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>eclipseProject</name> <name>Resent 1.8</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
@ -18,12 +18,12 @@
<link> <link>
<name>src_lwjgl_java</name> <name>src_lwjgl_java</name>
<type>2</type> <type>2</type>
<location>C:/Users/kay_j/Downloads/uwu/Resent-1.8/src/lwjgl/java</location> <location>C:/Users/kay_j/Downloads/uwu/Resent-1.8/src/lwjgl/java/</location>
</link> </link>
<link> <link>
<name>src_main_java</name> <name>src_main_java</name>
<type>2</type> <type>2</type>
<location>C:/Users/kay_j/Downloads/uwu/Resent-1.8/src/main/java</location> <location>C:/Users/kay_j/Downloads/uwu/Resent-1.8/src/main/java/</location>
</link> </link>
</linkedResources> </linkedResources>
</projectDescription> </projectDescription>

View File

@ -2,7 +2,7 @@
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication"> <launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/> <booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/eclipseProject/src_lwjgl_java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/MainClass.java"/> <listEntry value="/Resent 1.8/src_lwjgl_java/net/lax1dude/eaglercraft/v1_8/internal/lwjgl/MainClass.java"/>
</listAttribute> </listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES"> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/> <listEntry value="1"/>
@ -17,8 +17,8 @@
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/> <booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/> <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.lax1dude.eaglercraft.v1_8.internal.lwjgl.MainClass"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.lax1dude.eaglercraft.v1_8.internal.lwjgl.MainClass"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="eclipseProject"/> <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="Resent 1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="eclipseProject"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Resent 1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djava.library.path=."/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Djava.library.path=."/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="C:/Users/kay_j/Downloads/uwu/Resent-1.8/desktopRuntime"/> <stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="C:/Users/kay_j/Downloads/uwu/Resent-1.8/desktopRuntime"/>
</launchConfiguration> </launchConfiguration>

View File

@ -3,6 +3,7 @@ package dev.resent.visual.ui.clickgui.rewrite;
import dev.resent.client.Resent; import dev.resent.client.Resent;
import dev.resent.module.base.Mod; import dev.resent.module.base.Mod;
import dev.resent.module.base.setting.BooleanSetting; import dev.resent.module.base.setting.BooleanSetting;
import dev.resent.module.base.setting.ModeSetting;
import dev.resent.module.base.setting.Setting; import dev.resent.module.base.setting.Setting;
import dev.resent.util.misc.GlUtils; import dev.resent.util.misc.GlUtils;
import dev.resent.util.render.Color; 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.animation.SimpleAnimation;
import dev.resent.visual.ui.clickgui.rewrite.comp.Comp; 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.CompCheck;
import dev.resent.visual.ui.clickgui.rewrite.comp.impl.CompMode;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import net.lax1dude.eaglercraft.v1_8.Mouse; import net.lax1dude.eaglercraft.v1_8.Mouse;
@ -144,8 +147,8 @@ public class ClickGuiRewrite extends GuiScreen {
/* !------------- SETTINGS ----------------! */ /* !------------- SETTINGS ----------------! */
if (selectedMod != null) { if (selectedMod != null) {
fr.drawString("<", x+80, y+115+offset, -1, false); RenderUtils.drawRoundedRect(x+80, y+105, x+width-20, y+390, 16, secondaryColor);
RenderUtils.drawRoundedRect(x+80, y+125, x+width-20, y+325, 16, secondaryColor); fr.drawString("<", x+90, y+115+offset, -1, false);
for (Comp comp : comps) { for (Comp comp : comps) {
comp.drawScreen(mouseX, mouseY); 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()) { if (isMouseInside(mouseX, mouseY, x+width-60, y+140+offset+scrollOffset, x+width-40, y+160+offset+scrollOffset) && mouseButton == 0 && m.doesHaveSetting()) {
selectedMod = m; selectedMod = m;
int settingOffset = 0; drawSetting();
for (Setting s : selectedMod.settings) {
if (s instanceof BooleanSetting) {
comps.add(new CompCheck(x+110, y+125+settingOffset, selectedMod, s));
}
settingOffset += 25;
}
} }
if (isMouseInside(mouseX, mouseY, x+80, y+125+offset+scrollOffset, x+width-20, y+175+offset+scrollOffset)) { if (isMouseInside(mouseX, mouseY, x+80, y+125+offset+scrollOffset, x+width-20, y+175+offset+scrollOffset)) {
if (mouseButton == 1 && m.doesHaveSetting()) { if (mouseButton == 1 && m.doesHaveSetting()) {
selectedMod = m; selectedMod = m;
int settingOffset = 0; drawSetting();
for (Setting s : selectedMod.settings) {
if (s instanceof BooleanSetting) {
comps.add(new CompCheck(x+110, y+125+settingOffset, selectedMod, s));
}
settingOffset += 25;
}
} }
if (mouseButton == 0 && selectedMod == null) { if (mouseButton == 0 && selectedMod == null) {
@ -228,7 +217,7 @@ public class ClickGuiRewrite extends GuiScreen {
} }
if (selectedMod != null) { 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; selectedMod = null;
comps.clear(); comps.clear();
} }
@ -296,4 +285,23 @@ public class ClickGuiRewrite extends GuiScreen {
public void onGuiClosed() { public void onGuiClosed() {
mc.gameSettings.saveOptions(); 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;
}
}
} }

View File

@ -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) {
}
}