From 021f2ef785fc52a31daeb9cf5cc858f7c134192f Mon Sep 17 00:00:00 2001 From: ThisIsALegitUsername <73719631+ThisIsALegitUsername@users.noreply.github.com> Date: Tue, 28 Feb 2023 19:33:31 -0500 Subject: [PATCH] pre gui animations --- .../dev/resent/module/impl/hud/ClickGui.java | 2 +- .../java/dev/resent/visual/ui/ClickGUI.java | 4 ++-- .../java/dev/resent/visual/ui/PreGUI.java | 22 +++++++++++++------ .../visual/ui/animation/SimpleAnimation.java | 6 +++++ 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/main/java/dev/resent/module/impl/hud/ClickGui.java b/src/main/java/dev/resent/module/impl/hud/ClickGui.java index 471ce604..5cb93184 100644 --- a/src/main/java/dev/resent/module/impl/hud/ClickGui.java +++ b/src/main/java/dev/resent/module/impl/hud/ClickGui.java @@ -10,7 +10,7 @@ import dev.resent.module.base.setting.ModeSetting; public class ClickGui extends Mod{ public BooleanSetting scroll = new BooleanSetting("Smooth scroll", "", false); - public ModeSetting guiTheme = new ModeSetting("Gui theme", "New", "New", "Classic revised", "Die in a hole"); + public ModeSetting guiTheme = new ModeSetting("Gui theme", "New", "New", "Classic revised"); public ClickGui(){ addSetting(scroll, guiTheme); diff --git a/src/main/java/dev/resent/visual/ui/ClickGUI.java b/src/main/java/dev/resent/visual/ui/ClickGUI.java index efff938c..a331e488 100644 --- a/src/main/java/dev/resent/visual/ui/ClickGUI.java +++ b/src/main/java/dev/resent/visual/ui/ClickGUI.java @@ -205,12 +205,12 @@ public class ClickGUI extends GuiScreen { GlStateManager.disableBlend(); } - fr.drawStringWithShadow(m.getName(), this.x + 20 + xo, height - fh * -(off) + 50 - offset, -1); + fr.drawStringWithShadow(m.getName(), this.x + 24 + xo, height - fh * -(off) + 50 - offset, -1); } } else if (this.openedMod != null) { int var = 0; fr.drawString("<", x - 9 + 4, height + 29 + 9 + 2, -1); - fr.drawStringWithShadow("Resent - " + openedMod.getName(), sr.getScaledWidth() / 2 - (fr.getStringWidth("Resent - " + openedMod.getName()) / 2), height + 29 - 9 - 2, -1); + fr.drawStringWithShadow(ClientInfo.name + " - " + openedMod.getName(), sr.getScaledWidth() / 2 - (fr.getStringWidth("Resent - " + openedMod.getName()) / 2), height + 29 - 9 - 2, -1); for (int amogus = 0; amogus < this.openedMod.settings.size(); amogus++) { Setting s = this.openedMod.settings.get(amogus); diff --git a/src/main/java/dev/resent/visual/ui/PreGUI.java b/src/main/java/dev/resent/visual/ui/PreGUI.java index 4e107ccb..5c53666f 100644 --- a/src/main/java/dev/resent/visual/ui/PreGUI.java +++ b/src/main/java/dev/resent/visual/ui/PreGUI.java @@ -1,7 +1,8 @@ package dev.resent.visual.ui; import dev.resent.util.misc.GlUtils; -import dev.resent.util.render.RenderUtils; +import dev.resent.util.render.Color; +import dev.resent.visual.ui.animation.SimpleAnimation; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiScreen; @@ -10,16 +11,23 @@ import net.minecraft.util.ResourceLocation; public class PreGUI extends GuiScreen { Minecraft mc = Minecraft.getMinecraft(); + public SimpleAnimation opacityAnimation = new SimpleAnimation(0); + public SimpleAnimation slideAnimation = new SimpleAnimation(0); @Override public void drawScreen(int i, int j, float var3) { + + opacityAnimation.setAnimation(100, 5); + slideAnimation.setAnimation(200, 7); + + boolean isInside = isMouseInside(i, j, GuiScreen.width / 2 - 20, GuiScreen.height / 2 + 20, GuiScreen.width / 2 + 40, GuiScreen.height / 2 + 50); mc.getTextureManager().bindTexture(new ResourceLocation("eagler:gui/logo.png")); - Gui.drawModalRectWithCustomSizedTexture(GuiScreen.width / 2 - 20, GuiScreen.height / 2 - 50, 0, 0, 60, 60, 60, 60); - - Gui.drawRect(GuiScreen.width / 2 - 20, GuiScreen.height / 2 + 20, GuiScreen.width / 2 + 40, GuiScreen.height / 2 + 50, isMouseInside(i, j, GuiScreen.width / 2 - 20, GuiScreen.height / 2 + 20, GuiScreen.width / 2 + 40, GuiScreen.height / 2 + 50) ? 0x40FFFFFF : 0x50FFFFFF); - RenderUtils.drawRectOutline(GuiScreen.width / 2 - 20, GuiScreen.height / 2 + 20, GuiScreen.width / 2 + 40, GuiScreen.height / 2 + 50, 0x080FFFFFF); - GlUtils.drawCenteredScaledString("Mods", GuiScreen.width / 2 + 10, GuiScreen.height / 2 + 35 - mc.fontRendererObj.FONT_HEIGHT / 2, -1, 1f); - super.drawScreen(i, j, var3); + Gui.drawModalRectWithCustomSizedTexture(GuiScreen.width / 2 - 20, GuiScreen.height / 2 - 250 + (int)slideAnimation.getValue(), 0, 0, 60, 60, 60, 60); + Gui.drawRect(GuiScreen.width / 2 - 20, GuiScreen.height / 2 + 20, GuiScreen.width / 2 + 40, GuiScreen.height / 2 + 50, isInside ? 0x90FFFFFF : new Color(230, 230, 230, (int)opacityAnimation.getValue()).getRGB()); + //RenderUtils.drawRectOutline(GuiScreen.width / 2 - 20, GuiScreen.height / 2 + 20, GuiScreen.width / 2 + 40, GuiScreen.height / 2 + 50, 0x080FFFFFF); + if(opacityAnimation.isDone()) { + mc.fontRendererObj.drawStringWithShadow("Mods", GuiScreen.width / 2 - 2, GuiScreen.height / 2 + 35 - 9 / 2, -1); + } } @Override diff --git a/src/main/java/dev/resent/visual/ui/animation/SimpleAnimation.java b/src/main/java/dev/resent/visual/ui/animation/SimpleAnimation.java index 4d6cf3e2..8afaff9c 100644 --- a/src/main/java/dev/resent/visual/ui/animation/SimpleAnimation.java +++ b/src/main/java/dev/resent/visual/ui/animation/SimpleAnimation.java @@ -3,6 +3,7 @@ package dev.resent.visual.ui.animation; public class SimpleAnimation { private float value; + private float lastValue; private long lastMS; public SimpleAnimation(final float value) { @@ -14,6 +15,7 @@ public class SimpleAnimation { final long currentMS = System.currentTimeMillis(); final long delta = currentMS - this.lastMS; this.lastMS = currentMS; + lastValue = this.value; double deltaValue = 0.0; @@ -35,4 +37,8 @@ public class SimpleAnimation { public void setValue(float value) { this.value = value; } + + public boolean isDone() { + return lastValue >= value-1; + } }