diff --git a/src/main/java/com/skidders/SigmaReborn.java b/src/main/java/com/skidders/SigmaReborn.java index d77699b..1da5439 100644 --- a/src/main/java/com/skidders/SigmaReborn.java +++ b/src/main/java/com/skidders/SigmaReborn.java @@ -1,8 +1,7 @@ package com.skidders; import com.google.common.eventbus.EventBus; -import com.skidders.sigma.managers.FontManager; -import com.skidders.sigma.managers.ModuleManager; +import com.skidders.sigma.managers.*; import com.skidders.sigma.processors.ScreenProcessor; import net.fabricmc.api.ModInitializer; diff --git a/src/main/java/com/skidders/sigma/mixin/GameMenuScreenMixin.java b/src/main/java/com/skidders/sigma/mixin/GameMenuScreenMixin.java index b3f0425..44a07ec 100644 --- a/src/main/java/com/skidders/sigma/mixin/GameMenuScreenMixin.java +++ b/src/main/java/com/skidders/sigma/mixin/GameMenuScreenMixin.java @@ -1,6 +1,6 @@ package com.skidders.sigma.mixin; -import com.skidders.sigma.screens.InGameOptionsScreen; +import com.skidders.sigma.screens.pages.JelloOptionsPage; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.GameMenuScreen; import net.minecraft.client.gui.screen.Screen; @@ -26,7 +26,7 @@ private void initWidgets(CallbackInfo ci) { 204, 20, Text.of("Jello for Sigma Options"), - button -> MinecraftClient.getInstance().openScreen(new InGameOptionsScreen("Jello Options")) + button -> MinecraftClient.getInstance().openScreen(new JelloOptionsPage("Jello Options")) )); } diff --git a/src/main/java/com/skidders/sigma/module/settings/impl/BooleanSetting.java b/src/main/java/com/skidders/sigma/module/settings/impl/BooleanSetting.java index 76e9ae5..8f101ff 100644 --- a/src/main/java/com/skidders/sigma/module/settings/impl/BooleanSetting.java +++ b/src/main/java/com/skidders/sigma/module/settings/impl/BooleanSetting.java @@ -1,7 +1,7 @@ package com.skidders.sigma.module.settings.impl; import com.skidders.sigma.module.settings.Setting; -import com.skidders.sigma.screens.components.CheckboxComponent; +import com.skidders.sigma.screens.clickgui.components.CheckboxComponent; public class BooleanSetting extends Setting { public CheckboxComponent checkboxComponent; diff --git a/src/main/java/com/skidders/sigma/processors/ScreenProcessor.java b/src/main/java/com/skidders/sigma/processors/ScreenProcessor.java index ead11a6..66f64ea 100644 --- a/src/main/java/com/skidders/sigma/processors/ScreenProcessor.java +++ b/src/main/java/com/skidders/sigma/processors/ScreenProcessor.java @@ -3,8 +3,7 @@ import com.google.common.eventbus.Subscribe; import com.mojang.blaze3d.systems.RenderSystem; import com.skidders.sigma.events.impl.KeyPressEvent; -import com.skidders.sigma.events.impl.Render2DEvent; -import com.skidders.sigma.screens.ClickGUI; +import com.skidders.sigma.screens.clickgui.ClickGUI; import com.skidders.sigma.utils.IMinecraft; import com.skidders.sigma.utils.misc.StringUtil; import net.minecraft.client.gui.DrawableHelper; @@ -18,6 +17,8 @@ public class ScreenProcessor implements IMinecraft { public int clickGuiBind = 344; public String clickGuiBindName = "Unknown"; + public boolean guiBlur = true, gpuAccelerated = true; + public static int scaleFactor = 1; public ScreenProcessor() { diff --git a/src/main/java/com/skidders/sigma/screens/InGameOptionsScreen.java b/src/main/java/com/skidders/sigma/screens/InGameOptionsScreen.java deleted file mode 100644 index a0812d8..0000000 --- a/src/main/java/com/skidders/sigma/screens/InGameOptionsScreen.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.skidders.sigma.screens; - -import com.skidders.SigmaReborn; -import com.skidders.sigma.screens.components.ButtonLineComponent; -import com.skidders.sigma.utils.render.font.Renderer; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.text.Text; - -import java.awt.*; - -public class InGameOptionsScreen extends Screen { - - private final Renderer JelloMediumFont40 = SigmaReborn.INSTANCE.fontManager.getFont("HelveticaNeue-Medium", 40); - private final Renderer JelloLightFont25 = SigmaReborn.INSTANCE.fontManager.getFont("HelveticaNeue-Light", 25); - private final Renderer JelloLightFont20 = SigmaReborn.INSTANCE.fontManager.getFont("HelveticaNeue-Light", 20); - private final Renderer JelloLightFont24 = SigmaReborn.INSTANCE.fontManager.getFont("HelveticaNeue-Light", 24); - private final Renderer JelloLightFont14 = SigmaReborn.INSTANCE.fontManager.getFont("HelveticaNeue-Light", 14); - private final Renderer JelloLightFont18 = SigmaReborn.INSTANCE.fontManager.getFont("HelveticaNeue-Light", 18); - - private ButtonLineComponent clickGui, keybind, credits; - - public InGameOptionsScreen(String text) { - super(Text.of(text)); - } - - @Override - protected void init() { - super.init(); - - keybind = new ButtonLineComponent("Open Keybind Manager", width / 2 - 80, height / 2 + 113, JelloLightFont24, new Color(254, 254, 254), this); - clickGui = new ButtonLineComponent("Open Jello's Click GUI", width / 2 + 80, height / 2 + 113, JelloLightFont24, new Color(254, 254, 254), this); - credits = new ButtonLineComponent("Credits", width / 2, height / 2 + 20, JelloLightFont18, new Color(254, 254, 254), this); - } - - @Override - public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) { - super.render(matrices, mouseX, mouseY, delta); - - this.renderBackground(matrices); - - float jelloWidth = JelloMediumFont40.getWidth("Jello"); - float forSigmaWidth = JelloLightFont25.getWidth("for Sigma"); - float combinedWidth = jelloWidth + 10 + forSigmaWidth; - - float x = ((float) width - combinedWidth) / 2; - float y = ((float) height / 2) - 140; - - JelloMediumFont40.drawString("Jello", x, y, new Color(254, 254, 254)); - JelloLightFont25.drawString("for Sigma", x + jelloWidth + 2, y + 7, new Color(220, 220, 220)); - - String version = "You're currently using Sigma Reborn"; - JelloLightFont20.drawString(version, (float) width / 2 - JelloLightFont20.getWidth(version) / 2, y + 28, new Color(110, 111, 112)); - - JelloLightFont20.drawString("GUI Blur:", width / 2 - 80, height / 2 + 40, new Color(136, 137, 136)); - JelloLightFont20.drawString("GPU Accelerated:", width / 2 - 16, height / 2 + 40, new Color(136, 137, 136)); - - String clickguiBound = "Click GUI is currently bound to: " + SigmaReborn.INSTANCE.screenProcessor.clickGuiBindName + " Key"; - JelloLightFont20.drawString(clickguiBound, (float) width / 2 - JelloLightFont20.getWidth(clickguiBound) / 2, (float) height / 2 + 60, new Color(160, 161, 160)); - String configure = "Configure all your keybinds in the keybind manager!"; - JelloLightFont14.drawString(configure, (float) width / 2 - JelloLightFont14.getWidth(configure) / 2, (float) height / 2 + 75, new Color(103, 105, 103)); - - clickGui.draw(matrices, mouseX, mouseY); - keybind.draw(matrices, mouseX, mouseY); - credits.draw(matrices, mouseX, mouseY); - } - - @Override - public boolean mouseClicked(double mouseX, double mouseY, int button) { - if (button == 0) { - if (clickGui.click(mouseX, mouseY, button)) { - MinecraftClient.getInstance().openScreen(SigmaReborn.INSTANCE.screenProcessor.clickGUI); - } - - if (keybind.click(mouseX, mouseY, button)) { - - } - - if (credits.click(mouseX, mouseY, button)) { - - } - } - - return super.mouseClicked(mouseX, mouseY, button); - } -} diff --git a/src/main/java/com/skidders/sigma/screens/SettingGUI.java b/src/main/java/com/skidders/sigma/screens/SettingGUI.java deleted file mode 100644 index 45f251a..0000000 --- a/src/main/java/com/skidders/sigma/screens/SettingGUI.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.skidders.sigma.screens; - -import com.skidders.SigmaReborn; -import com.skidders.sigma.module.Module; -import com.skidders.sigma.module.settings.Setting; -import com.skidders.sigma.module.settings.impl.BooleanSetting; -import com.skidders.sigma.module.settings.impl.ModeSetting; -import com.skidders.sigma.utils.misc.MouseHandler; -import com.skidders.sigma.utils.render.RenderUtil; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.util.math.MatrixStack; - -import java.awt.*; - -public class SettingGUI { - private final Module parent; - private final ClickGUI screen; - private final MouseHandler mouseHandler; - - public SettingGUI(Module parent) { - this.parent = parent; - this.screen = SigmaReborn.INSTANCE.screenProcessor.clickGUI; - this.mouseHandler = new MouseHandler(MinecraftClient.getInstance().getWindow().getHandle()); - } - - public void draw(MatrixStack matrices, double mouseX, double mouseY) { - float width = 210, height = 240; - float x = (float) screen.width / 2 - width / 2, - y = (float) screen.height / 2 - height / 2; - - RenderUtil.drawRectangle(matrices, 0, 0, screen.width, screen.height, new Color(0, 0, 0, 150)); - - RenderUtil.drawRectangle(matrices, x, y, width, height, new Color(254, 254, 254)); - screen.moduleName.drawString(parent.name, x, y - 30, new Color(254, 254, 254)); - screen.light20.drawString(parent.desc, x + 12, y + 15, new Color(100, 100, 100)); - - if (!parent.settings.isEmpty()) { - float yOffset = y + 35; - for (Setting setting : parent.settings) { - //full setting bounds - x, yOffset - 2, width, 18 - screen.settingName.drawString(setting.name, x + 12, yOffset, Color.BLACK); - if (RenderUtil.hovered(mouseX, mouseY, x, yOffset - 2, width, 18)) { - screen.settingSB.drawString("§l" + setting.name, x + 7, y + height + 7, new Color(255, 255, 255, 127)); - screen.settingS.drawString(setting.desc, x + 7 + screen.settingSB.getWidth(setting.name), y + height + 7, new Color(255, 255, 255, 127)); - } - - if (setting instanceof BooleanSetting bruh) { - bruh.value = bruh.checkboxComponent.draw(mouseHandler, bruh.value, mouseX, mouseY, x + width - 20, yOffset + 1.3f); - } else if (setting instanceof ModeSetting bruh) { - - } - - yOffset += 18; - } - } - } - - public boolean click(double mouseX, double mouseY, int button) { - float width = 210, height = 240; - float x = (float) screen.width / 2 - width / 2, - y = (float) screen.height / 2 - height / 2; - - if (button == 0) { - if (RenderUtil.hovered(mouseX, mouseY, x, y, width, height)) { - - } else { - screen.settingGUI = null; - } - } - - return true; - } - - -} diff --git a/src/main/java/com/skidders/sigma/screens/ClickGUI.java b/src/main/java/com/skidders/sigma/screens/clickgui/ClickGUI.java similarity index 99% rename from src/main/java/com/skidders/sigma/screens/ClickGUI.java rename to src/main/java/com/skidders/sigma/screens/clickgui/ClickGUI.java index c158340..a357ec7 100644 --- a/src/main/java/com/skidders/sigma/screens/ClickGUI.java +++ b/src/main/java/com/skidders/sigma/screens/clickgui/ClickGUI.java @@ -1,4 +1,4 @@ -package com.skidders.sigma.screens; +package com.skidders.sigma.screens.clickgui; import com.mojang.blaze3d.systems.RenderSystem; import com.skidders.SigmaReborn; diff --git a/src/main/java/com/skidders/sigma/screens/clickgui/SettingGUI.java b/src/main/java/com/skidders/sigma/screens/clickgui/SettingGUI.java new file mode 100644 index 0000000..ef1daa3 --- /dev/null +++ b/src/main/java/com/skidders/sigma/screens/clickgui/SettingGUI.java @@ -0,0 +1,108 @@ +package com.skidders.sigma.screens.clickgui; + +import com.skidders.SigmaReborn; +import com.skidders.sigma.module.Module; +import com.skidders.sigma.module.settings.Setting; +import com.skidders.sigma.module.settings.impl.BooleanSetting; +import com.skidders.sigma.module.settings.impl.NumberSetting; +import com.skidders.sigma.utils.misc.MouseHandler; +import com.skidders.sigma.utils.render.RenderUtil; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.util.math.MatrixStack; +import org.lwjgl.glfw.GLFW; + +import java.awt.*; + +public class SettingGUI { + private final Module parent; + private final ClickGUI screen; + private final MouseHandler mouseHandler; + + public SettingGUI(Module parent) { + this.parent = parent; + this.screen = SigmaReborn.INSTANCE.screenProcessor.clickGUI; + this.mouseHandler = new MouseHandler(MinecraftClient.getInstance().getWindow().getHandle()); + } + + public void draw(MatrixStack matrices, double mouseX, double mouseY) { + float width = 210, height = 240; + float x = (float) screen.width / 2 - width / 2, + y = (float) screen.height / 2 - height / 2; + + RenderUtil.drawRectangle(matrices, 0, 0, screen.width, screen.height, new Color(0, 0, 0, 150)); + + RenderUtil.drawRectangle(matrices, x, y, width, height, new Color(254, 254, 254)); + screen.moduleName.drawString(parent.name, x, y - 30, new Color(254, 254, 254)); + screen.light20.drawString(parent.desc, x + 12, y + 15, new Color(100, 100, 100)); + + boolean mouseDown = GLFW.glfwGetMouseButton(MinecraftClient.getInstance().getWindow().getHandle(), GLFW.GLFW_MOUSE_BUTTON_LEFT) == GLFW.GLFW_PRESS; + + if (!parent.settings.isEmpty()) { + float offset = y + 35; + for (Setting setting : parent.settings) { + //full setting bounds - x, offset - 2, width, 18 + screen.settingName.drawString(setting.name, x + 12, offset, Color.BLACK); + if (RenderUtil.hovered(mouseX, mouseY, x, offset - 2, width, 18)) { + screen.settingSB.drawString("§l" + setting.name, x + 7, y + height + 7, new Color(255, 255, 255, 127)); + screen.settingS.drawString(setting.desc, x + 7 + screen.settingSB.getWidth(setting.name), y + height + 7, new Color(255, 255, 255, 127)); + } + + if (setting instanceof BooleanSetting sett) { + sett.value = sett.checkboxComponent.draw(mouseHandler, sett.value, mouseX, mouseY, x + width - 20, offset + 1.3f); + } else if (setting instanceof NumberSetting numb) { + float min = numb.min; + float max = numb.max; + float val = numb.value.floatValue(); + int point = numb.getDecimalPlaces(); + + float normalizedValue = (val - min) / (max - min); + float sliderWidth = normalizedValue * 50; + + Color bgColor = new Color(215, 234, 254); + Color filledColor = new Color(59, 153, 253); + + RenderUtil.drawRectangle(matrices, x + width - 66, offset + 5.5f, 50, 3.5f, bgColor); + RenderUtil.drawRectangle(matrices, x + width - 66, offset + 5.5f, sliderWidth, 3.5f, filledColor); + + float circleX = x + width - 66 + sliderWidth; + + boolean hoverSlider = RenderUtil.hovered(mouseX, mouseY, x + width - 69, offset + 2, 55, 10); + if (hoverSlider) { + int textOffset = val <= min + (max - min) * 0.07 ? -5 : 0; + screen.sliderValue.drawString(numb.value.toString(), x + width - 70 - screen.sliderValue.getWidth(numb.value.toString()) + textOffset, (float) (offset + 4.25), new Color(125, 125, 125)); + + if (mouseDown) { + double normalizedX = (mouseX - (x + width - 66)) / (50); + double newValue = min + normalizedX * (max - min); + newValue = Math.min(Math.max(newValue, min), max); + numb.value = newValue; + } + } + + RenderUtil.drawCircle(circleX, offset + 7, 6, new Color(200, 200, 200 )); + RenderUtil.drawCircle(circleX, offset + 7, 5.5, new Color(254, 254, 254)); + } + + offset += 18; + } + } + } + + public boolean click(double mouseX, double mouseY, int button) { + float width = 210, height = 240; + float x = (float) screen.width / 2 - width / 2, + y = (float) screen.height / 2 - height / 2; + + if (button == 0) { + if (RenderUtil.hovered(mouseX, mouseY, x, y, width, height)) { + + } else { + screen.settingGUI = null; + } + } + + return true; + } + + +} diff --git a/src/main/java/com/skidders/sigma/screens/components/ButtonLineComponent.java b/src/main/java/com/skidders/sigma/screens/clickgui/components/ButtonLineComponent.java similarity index 96% rename from src/main/java/com/skidders/sigma/screens/components/ButtonLineComponent.java rename to src/main/java/com/skidders/sigma/screens/clickgui/components/ButtonLineComponent.java index de8e04f..0b393fd 100644 --- a/src/main/java/com/skidders/sigma/screens/components/ButtonLineComponent.java +++ b/src/main/java/com/skidders/sigma/screens/clickgui/components/ButtonLineComponent.java @@ -1,4 +1,4 @@ -package com.skidders.sigma.screens.components; +package com.skidders.sigma.screens.clickgui.components; import com.skidders.sigma.utils.render.font.Renderer; import com.skidders.sigma.utils.render.RenderUtil; diff --git a/src/main/java/com/skidders/sigma/screens/components/CheckboxComponent.java b/src/main/java/com/skidders/sigma/screens/clickgui/components/CheckboxComponent.java similarity index 94% rename from src/main/java/com/skidders/sigma/screens/components/CheckboxComponent.java rename to src/main/java/com/skidders/sigma/screens/clickgui/components/CheckboxComponent.java index b5cf043..24567f6 100644 --- a/src/main/java/com/skidders/sigma/screens/components/CheckboxComponent.java +++ b/src/main/java/com/skidders/sigma/screens/clickgui/components/CheckboxComponent.java @@ -1,4 +1,4 @@ -package com.skidders.sigma.screens.components; +package com.skidders.sigma.screens.clickgui.components; import com.skidders.sigma.utils.misc.MouseHandler; import com.skidders.sigma.utils.render.RenderUtil;