sexy ahh buttons

This commit is contained in:
ThisIsALegitUsername 2023-02-26 14:01:36 -05:00
parent 0adcf06736
commit a54d9b5e68
3 changed files with 26 additions and 14 deletions

View File

@ -4,6 +4,7 @@ import dev.resent.annotation.Module;
import dev.resent.module.base.setting.Setting; import dev.resent.module.base.setting.Setting;
import dev.resent.util.render.RenderUtils; import dev.resent.util.render.RenderUtils;
import dev.resent.visual.ui.Theme; import dev.resent.visual.ui.Theme;
import dev.resent.visual.ui.animation.SimpleAnimation;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -19,6 +20,7 @@ public abstract class Mod {
private boolean hasSetting; private boolean hasSetting;
public boolean expanded; public boolean expanded;
public int index; public int index;
public SimpleAnimation animation = new SimpleAnimation(0);
public List<Setting> settings = new ArrayList<>(); public List<Setting> settings = new ArrayList<>();

View File

@ -12,7 +12,7 @@ public class RoundedUtil {
public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) { public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
glPushAttrib(0); glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D); GlStateManager.scale(0.5D, 0.5D, 0.5D);
x *= 2.0D; x *= 2.0D;
y *= 2.0D; y *= 2.0D;
x1 *= 2.0D; x1 *= 2.0D;
@ -43,19 +43,19 @@ public class RoundedUtil {
for (i = 90; i <= 180; i += 3) for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd(); glEnd();
glEnable(RealOpenGLEnums.GL_TEXTURE_2D); GlStateManager.enableTexture2D();
glDisable(RealOpenGLEnums.GL_BLEND); GlStateManager.disableBlend();
glDisable(RealOpenGLEnums.GL_LINE_SMOOTH); glDisable(RealOpenGLEnums.GL_LINE_SMOOTH);
glDisable(RealOpenGLEnums.GL_LINE_SMOOTH); glDisable(RealOpenGLEnums.GL_LINE_SMOOTH);
glEnable(RealOpenGLEnums.GL_TEXTURE_2D); GlStateManager.enableTexture2D();
glScaled(2.0D, 2.0D, 2.0D); GlStateManager.scale(2.0D, 2.0D, 2.0D);
glPopAttrib(); glPopAttrib();
glLineWidth(1); glLineWidth(1);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
} }
public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) { public static void drawRoundedRect(float x, float y, float x1, float y1, float radius, int color) {
glPushAttrib(0); glPushAttrib(0);
glScaled(0.5D, 0.5D, 0.5D); GlStateManager.scale(0.5D, 0.5D, 0.5D);
x *= 2.0D; x *= 2.0D;
y *= 2.0D; y *= 2.0D;
x1 *= 2.0D; x1 *= 2.0D;
@ -76,12 +76,10 @@ public class RoundedUtil {
for (i = 90; i <= 180; i += 3) for (i = 90; i <= 180; i += 3)
glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius); glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y + radius + Math.cos(i * Math.PI / 180.0D) * radius);
glEnd(); glEnd();
glEnable(RealOpenGLEnums.GL_TEXTURE_2D); GlStateManager.enableTexture2D();
glDisable(RealOpenGLEnums.GL_BLEND); GlStateManager.disableBlend();
glDisable(RealOpenGLEnums.GL_LINE_SMOOTH); GlStateManager.disableBlend();
glDisable(RealOpenGLEnums.GL_BLEND); GlStateManager.scale(2.0D, 2.0D, 2.0D);
glDisable(RealOpenGLEnums.GL_LINE_SMOOTH);
glScaled(2.0D, 2.0D, 2.0D);
glEnable(RealOpenGLEnums.GL_BLEND); glEnable(RealOpenGLEnums.GL_BLEND);
glPopAttrib(); glPopAttrib();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);

View File

@ -14,6 +14,7 @@ import dev.resent.util.render.Color;
import dev.resent.util.render.RenderUtils; import dev.resent.util.render.RenderUtils;
import dev.resent.visual.ui.animation.Animation; import dev.resent.visual.ui.animation.Animation;
import dev.resent.visual.ui.animation.Direction; import dev.resent.visual.ui.animation.Direction;
import dev.resent.visual.ui.animation.SimpleAnimation;
import net.lax1dude.eaglercraft.v1_8.Keyboard; import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.lax1dude.eaglercraft.v1_8.Mouse; import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
@ -167,7 +168,18 @@ public class ClickGUI extends GuiScreen {
int fh = 9; int fh = 9;
if (height - 2 - fh * -(off) + 50 - 2 - offset > height + 29 && height + 30 - fh * (-off) + 30 + 2 - offset < y + 20 && introAnimation.isDone()) { if (height - 2 - fh * -(off) + 50 - 2 - offset > height + 29 && height + 30 - fh * (-off) + 30 + 2 - offset < y + 20 && introAnimation.isDone()) {
// Enabled outline // Enabled outline
float goofy = 0;
if(m.isEnabled()) {
goofy = 20;
}else {
goofy = 0;
}
m.animation.setAnimation(m.isEnabled() ? 20 : 0, 5);
RenderUtils.drawRoundedRect(this.x + 10 + xo - 2 + 10, height - 2 - fh * -(off) + 50 - 2 - offset, this.x + 90 + xo + 22, height + 30 - fh * (-off) + 30 + 2 - offset, 4, m.isEnabled() ? Color.GREEN.getRGB() : Color.RED.getRGB(), true); RenderUtils.drawRoundedRect(this.x + 10 + xo - 2 + 10, height - 2 - fh * -(off) + 50 - 2 - offset, this.x + 90 + xo + 22, height + 30 - fh * (-off) + 30 + 2 - offset, 4, m.isEnabled() ? Color.GREEN.getRGB() : Color.RED.getRGB(), true);
RenderUtils.drawRoundedRect(this.x+48+xo, height-2-fh*-(off)+48-offset+15, this.x+80+xo, height+30-fh*-off+30+2-offset+10, 5, -1, true);
RenderUtils.drawRoundedRect(this.x+48+xo+m.animation.getValue(), height-2-fh*-(off)+48-offset+15, this.x+60+xo+m.animation.getValue(), height+30-fh*-off+30+2-offset+10, 5, 0xFF990000, true);
drawRect( drawRect(
this.x + 10 + xo - 1 + 10, this.x + 10 + xo - 1 + 10,
height - 2 - fh * -(off) + 50 - 1 - offset, height - 2 - fh * -(off) + 50 - 1 - offset,
@ -194,8 +206,8 @@ public class ClickGUI extends GuiScreen {
for (int amogus = 0; amogus < this.modWatching.settings.size(); amogus++) { for (int amogus = 0; amogus < this.modWatching.settings.size(); amogus++) {
Setting s = this.modWatching.settings.get(amogus); Setting s = this.modWatching.settings.get(amogus);
if(s instanceof CustomRectSettingDraw){ if(s instanceof CustomRectSettingDraw){
Gui.drawRect(x+21, height+41+var, x+27+fr.getStringWidth(s.name), height+var+53, isMouseInside(mouseX, mouseY, x+21, height+39+var, x+26+fr.getStringWidth(s.name), height+var+51) ? new Color(20, 20, 100, 70).getRGB() : new Color(20, 50, 170).getRGB()); drawRect(x+21, height+41+var, x+27+fr.getStringWidth(s.name), height+var+53, isMouseInside(mouseX, mouseY, x+21, height+39+var, x+26+fr.getStringWidth(s.name), height+var+51) ? new Color(150, 150, 150).getRGB() : new Color(211, 211, 211).getRGB());
RenderUtils.drawRectOutline(x+21, height+41+var, x+27+fr.getStringWidth(s.name), height+var+53, -1); //RenderUtils.drawRectOutline(x+21, height+41+var, x+27+fr.getStringWidth(s.name), height+var+53, -1);
fr.drawStringWithShadow(s.name, this.x + 24, height +43 + var, -1); fr.drawStringWithShadow(s.name, this.x + 24, height +43 + var, -1);
var += 3; var += 3;
} }