Skip to content

Commit

Permalink
move around stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkGG8181 committed Dec 25, 2024
1 parent 8ee1fd7 commit 2bf1dbf
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 172 deletions.
3 changes: 1 addition & 2 deletions src/main/java/com/skidders/SigmaReborn.java
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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"))
));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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<Boolean> {
public CheckboxComponent checkboxComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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() {
Expand Down
87 changes: 0 additions & 87 deletions src/main/java/com/skidders/sigma/screens/InGameOptionsScreen.java

This file was deleted.

75 changes: 0 additions & 75 deletions src/main/java/com/skidders/sigma/screens/SettingGUI.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
Expand Down
108 changes: 108 additions & 0 deletions src/main/java/com/skidders/sigma/screens/clickgui/SettingGUI.java
Original file line number Diff line number Diff line change
@@ -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;
}


}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 2bf1dbf

Please sign in to comment.