pre gui animations

This commit is contained in:
ThisIsALegitUsername 2023-02-28 19:33:31 -05:00
parent 1301e46b3c
commit 021f2ef785
4 changed files with 24 additions and 10 deletions

View File

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

View File

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

View File

@ -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) {
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);
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 - 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

View File

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