Update HUDConfigScreen.java

This commit is contained in:
kirillsaint 2023-08-31 19:18:58 +06:00
parent 328c9b7b25
commit 0657fd107c

View File

@ -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;
}