From 0657fd107ce8ab9d87511577a1d7c7b8b854993a Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Thu, 31 Aug 2023 19:18:58 +0600 Subject: [PATCH] Update HUDConfigScreen.java --- .../client/gui/hud/HUDConfigScreen.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java b/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java index 67d34a8..d55a2a9 100644 --- a/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java +++ b/src/main/java/net/silentclient/client/gui/hud/HUDConfigScreen.java @@ -8,8 +8,11 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; import net.silentclient.client.gui.SilentScreen; +import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.elements.IconButton; import net.silentclient.client.gui.font.SilentFontRenderer.FontType; +import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; +import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.mods.CustomFontRenderer; import net.silentclient.client.mods.CustomFontRenderer.RenderMode; import net.silentclient.client.mods.Mod; @@ -23,6 +26,7 @@ import net.silentclient.client.utils.Sounds; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; +import java.awt.*; import java.io.IOException; import java.util.ArrayList; @@ -31,6 +35,8 @@ public class HUDConfigScreen extends GuiScreen { private final GuiScreen screen; private CustomFontRenderer font; private Mod mod = null; + private SimpleAnimation xLineAnimation; + private SimpleAnimation yLineAnimation; @Override public void initGui() { @@ -48,6 +54,9 @@ public class HUDConfigScreen extends GuiScreen { ((ModDraggable) m).setDragging(false); } } + + xLineAnimation = new SimpleAnimation(0); + yLineAnimation = new SimpleAnimation(0); } public HUDConfigScreen(GuiScreen screen) { @@ -96,7 +105,7 @@ public class HUDConfigScreen extends GuiScreen { if(((ModDraggable) m).getCornerScalingType() != null && ((ModDraggable) m).getCornerScalingType() != CornerScalingType.NONE) { Setting setting = Client.getInstance().getSettingsManager().getSettingByName(m, "Scale"); - float scale = 0; + float scale; scale = mouseY / (((ModDraggable) m).getPos().getAbsoluteY() + (((ModDraggable) m).getCornerY(((ModDraggable) m).getCornerScalingType()) * ((ModDraggable) m).getScale())); scale = scale - 1; scale = setting.getValFloat() + scale; @@ -109,6 +118,26 @@ public class HUDConfigScreen extends GuiScreen { } } + if(mod != null && ((ModDraggable) mod).isDragging() && Mouse.isButtonDown(0)) { + if(MouseUtils.isInside(mouseX, mouseY, this.width / 2 - ((30 + ((ModDraggable) mod).getScaledWidth()) / 2), 0, (30 + ((ModDraggable) mod).getScaledWidth()), height)) { + yLineAnimation.setAnimation(255, 12); + } else { + yLineAnimation.setAnimation(0, 12); + } + + if(MouseUtils.isInside(mouseX, mouseY, 0, this.height / 2 - ((30 + ((ModDraggable) mod).getScaledHeight()) / 2), width, (30 + ((ModDraggable) mod).getScaledHeight()))) { + xLineAnimation.setAnimation(255, 12); + } else { + xLineAnimation.setAnimation(0, 12); + } + } else { + yLineAnimation.setAnimation(0, 12); + xLineAnimation.setAnimation(0, 12); + } + + RenderUtils.drawRect(0, this.height / 2, this.width, 1, new Color(255, 255, 255, (int) xLineAnimation.getValue()).getRGB()); + RenderUtils.drawRect(this.width / 2, 0, 1, this.height, new Color(255, 255, 255, (int) yLineAnimation.getValue()).getRGB()); + if(mod != null && !((ModDraggable) mod).isDragging()) { this.mod = null; }