gui improved + betterbuttons

This commit is contained in:
Rxn69 2023-06-16 21:39:38 +05:30
parent 87841bc78b
commit 0b6194991f
11 changed files with 1669 additions and 682 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,7 @@ public class Gui
/** /**
* Draw a 1 pixel wide horizontal line. Args: x1, x2, y, color * Draw a 1 pixel wide horizontal line. Args: x1, x2, y, color
*/ */
protected void drawHorizontalLine(int startX, int endX, int y, int color) public static void drawHorizontalLine(int startX, int endX, int y, int color)
{ {
if (endX < startX) if (endX < startX)
{ {

View File

@ -109,14 +109,22 @@ public class GuiButton extends Gui
if(opacity > 120) opacity = 120; if(opacity > 120) opacity = 120;
} else { } else {
opacity -= 25; opacity -= 25;
if(opacity < 50) opacity = 50; if(opacity < 70) opacity = 70;
} }
Gui.drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, new Color(100, 100, 100, opacity).getRGB());
Color rectCol = new Color(100, 100, 100, opacity);
if(!this.enabled)
rectCol = new Color(170, 170, 170, 120);
else
rectCol = new Color(10, 10, 10, opacity);
Gui.drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, rectCol.getRGB());
// RoundedUtils.drawGradientRound(this.xPosition + 1, this.yPosition + 1, (this.width) - 1, (this.height) - 1, 6, ColorUtil.getClientColor(0, 255), ColorUtil.getClientColor(90, 255), ColorUtil.getClientColor(180, 255), ColorUtil.getClientColor(270, 255)); // RoundedUtils.drawGradientRound(this.xPosition + 1, this.yPosition + 1, (this.width) - 1, (this.height) - 1, 6, ColorUtil.getClientColor(0, 255), ColorUtil.getClientColor(90, 255), ColorUtil.getClientColor(180, 255), ColorUtil.getClientColor(270, 255));
//RoundedUtils.drawRoundedRect(this.xPosition + 1, this.yPosition + 1, (this.xPosition + this.width) - 1, (this.yPosition + this.height) - 1, 12, new Color(22, 24, 27,100).getRGB()); //RoundedUtils.drawRoundedRect(this.xPosition + 1, this.yPosition + 1, (this.xPosition + this.width) - 1, (this.yPosition + this.height) - 1, 12, new Color(22, 24, 27,100).getRGB());
if(this.hovered) { if(this.hovered && this.enabled) {
if (!(lineHoverAnimation.getValue() > width / 2 - 2)) { if (!(lineHoverAnimation.getValue() > width / 2 - 2)) {
lineHoverAnimation.setAnimation(width / 2 - 2, 10); lineHoverAnimation.setAnimation(width / 2 - 2, 10);
@ -143,16 +151,22 @@ public class GuiButton extends Gui
if (!this.enabled) if (this.enabled)
{ {
j = 10526880; j = -1;
} }
else if (this.hovered) else
{ {
j = 16777120; j = Color.BLACK.getRGB();
} }
FontManager.baloo17.drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 12) / 2, -1); rip.athena.client.utils.font.FontManager.getProductSansBold(19).drawCenteredString(displayString.toUpperCase(),
xPosition + (width / 2), this.enabled ? yPosition + (height / 2) - 3 : yPosition + (height / 2) - 6, j);
if (!this.enabled)
rip.athena.client.utils.font.FontManager.getProductSansBold(10).drawCenteredString("DISABLED",
xPosition + (width / 2), yPosition + (height / 2) + 4, j);
} }
} }

View File

@ -660,7 +660,7 @@ public abstract class GuiScreen extends Gui implements GuiYesNoCallback
} }
else else
{ {
DrawUtils.drawImage(new ResourceLocation("Athena/menu/test.png"), 0, 0, width, height); DrawUtils.drawImage(new ResourceLocation("Athena/menu/cool_wallpaper.png"), 0, 0, width, height);
//this.drawBackground(tint); //this.drawBackground(tint);
} }
} }

View File

@ -4,6 +4,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import java.awt.*;
public class GuiSlider extends GuiButton public class GuiSlider extends GuiButton
{ {
private float sliderPosition = 1.0F; private float sliderPosition = 1.0F;
@ -87,8 +89,10 @@ public class GuiSlider extends GuiButton
} }
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(this.xPosition + (int)(this.sliderPosition * (float)(this.width - 8)), this.yPosition, 0, 66, 4, 20);
this.drawTexturedModalRect(this.xPosition + (int)(this.sliderPosition * (float)(this.width - 8)) + 4, this.yPosition, 196, 66, 4, 20); Gui.drawRect(this.xPosition + (int)(this.sliderPosition * (float)(this.width - 8)), this.yPosition, this.xPosition + (int)(this.sliderPosition * (float)(this.width - 8)) + 4, this.yPosition + 20, new Color(250, 250, 250).getRGB());
// Gui.drawRect(this.xPosition + (int)(this.sliderPosition * (float)(this.width - 8)) + 4, this.yPosition, this.xPosition + (int)(this.sliderPosition * (float)(this.width - 8)) + 4, this.yPosition + 20, new Color(250, 250, 250).getRGB());
} }
} }

View File

@ -137,10 +137,10 @@ public class IngameMenu extends MinecraftMenuImpl implements DrawImpl {
drawShadowDown(menu.getX(), menu.getY() + 58, menu.getWidth()); drawShadowDown(menu.getX(), menu.getY() + 58, menu.getWidth());
RoundedUtils.drawGradientRound(menu.getX() - 1, menu.getY() - 1, menu.getWidth() + 2, menu.getHeight() + 2, 32, ColorUtil.getClientColor(0, 255), ColorUtil.getClientColor(90, 255), ColorUtil.getClientColor(180, 255), ColorUtil.getClientColor(270, 255)); RoundedUtils.drawGradientRound(menu.getX() - 1, menu.getY() - 1, menu.getWidth() + 2, menu.getHeight() + 2, 16, ColorUtil.getClientColor(0, 255), ColorUtil.getClientColor(90, 255), ColorUtil.getClientColor(180, 255), ColorUtil.getClientColor(270, 255));
RoundedUtils.drawRoundedRect(menu.getX(), menu.getY(), menu.getX() + menu.getWidth(), menu.getY() + menu.getHeight(), 64, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getFirstColor()); RoundedUtils.drawRoundedRect(menu.getX(), menu.getY(), menu.getX() + menu.getWidth(), menu.getY() + menu.getHeight(), 16, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getFirstColor());
rip.athena.client.utils.font.FontManager.getNunitoBold(50).drawString(Athena.INSTANCE.getClientName().toUpperCase(), menu.getX() + 60, menu.getY() + 17, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getTextColor()); rip.athena.client.utils.font.FontManager.getProductSansBold(60).drawString(Athena.INSTANCE.getClientName(), menu.getX() + 60, menu.getY() + 17, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getTextColor());
//DrawUtils.drawImage(new ResourceLocation("Athena/logo/pride.png"), (int) (menu.getX() + FontManager.font1.getStringWidth(Athena.INSTANCE.getClientName().toUpperCase()) + 70), (int) (menu.getY() - 10 + FontManager.font1.getHeight(Athena.INSTANCE.getClientName().toUpperCase())), 30, 30); //DrawUtils.drawImage(new ResourceLocation("Athena/logo/pride.png"), (int) (menu.getX() + FontManager.font1.getStringWidth(Athena.INSTANCE.getClientName().toUpperCase()) + 70), (int) (menu.getY() - 10 + FontManager.font1.getHeight(Athena.INSTANCE.getClientName().toUpperCase())), 30, 30);

View File

@ -74,9 +74,9 @@ public class ModCategoryButton extends MenuButton {
if(Settings.customGuiFont) { if(Settings.customGuiFont) {
if(text.equalsIgnoreCase("EDIT HUD")) { if(text.equalsIgnoreCase("EDIT HUD")) {
rip.athena.client.utils.font.FontManager.getNunitoBold(25).drawString(text, x + (width / 2 - getStringWidth(text) / 2) - 7, y + height / 2 - (getStringHeight(text) / 2) - 3, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getTextColor()); rip.athena.client.utils.font.FontManager.getProductSansBold(35).drawString(text, x + (width / 2 - getStringWidth(text) / 2), y + height / 2 - (getStringHeight(text) / 2) - 3, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getTextColor());
} else { } else {
rip.athena.client.utils.font.FontManager.getNunitoBold(25).drawString(text, x + (width / 2 - getStringWidth(text) / 2), y + height / 2 - (getStringHeight(text) / 2) - 3, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getTextColor()); rip.athena.client.utils.font.FontManager.getProductSansBold(25).drawString(text, x + (width / 2 - getStringWidth(text) / 2), y + height / 2 - (getStringHeight(text) / 2) - 3, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getTextColor());
} }
} else { } else {
Minecraft.getMinecraft().fontRendererObj.drawString(text, x + (width / 2 - getStringWidth(text) / 2), y + height / 2 - (getStringHeight(text) / 2) - 3, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getTextColor()); Minecraft.getMinecraft().fontRendererObj.drawString(text, x + (width / 2 - getStringWidth(text) / 2), y + height / 2 - (getStringHeight(text) / 2) - 3, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getTextColor());

View File

@ -186,17 +186,13 @@ public class AthenaMenu extends GuiScreen implements GuiYesNoCallback
int j = this.height / 4 + 48; int j = this.height / 4 + 48;
if (this.mc.isDemo())
{
this.addDemoButtons(j, 24);
}
else
{ {
this.addSingleplayerMultiplayerButtons(j, 24); this.addSingleplayerMultiplayerButtons(j, 24);
} }
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, j + 72 + 12, 98, 20, I18n.format("menu.options", new Object[0]))); this.buttonList.add(new GuiButton(0, this.width / 2 - 100, j + 72 - 24, 98, 20, I18n.format("menu.options", new Object[0])));
this.buttonList.add(new GuiButton(4, this.width / 2 + 2, j + 72 + 12, 98, 20, "Store")); this.buttonList.add(new GuiButton(4, this.width / 2 + 2, j + 72 - 24, 98, 20, "Store"));
} }
@ -204,20 +200,7 @@ public class AthenaMenu extends GuiScreen implements GuiYesNoCallback
{ {
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0]))); this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0])));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0]))); this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0])));
this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0]).replace("Minecraft", "").trim())); // this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0]).replace("Minecraft", "").trim()));
}
private void addDemoButtons(int p_73972_1_, int p_73972_2_)
{
this.buttonList.add(new GuiButton(11, this.width / 2 - 100, p_73972_1_, I18n.format("menu.playdemo", new Object[0])));
this.buttonList.add(this.buttonResetDemo = new GuiButton(12, this.width / 2 - 100, p_73972_1_ + p_73972_2_ * 1, I18n.format("menu.resetdemo", new Object[0])));
ISaveFormat isaveformat = this.mc.getSaveLoader();
WorldInfo worldinfo = isaveformat.getWorldInfo("Demo_World");
if (worldinfo == null)
{
this.buttonResetDemo.enabled = false;
}
} }
protected void actionPerformed(GuiButton button) throws IOException protected void actionPerformed(GuiButton button) throws IOException
@ -310,19 +293,19 @@ public class AthenaMenu extends GuiScreen implements GuiYesNoCallback
public void drawScreen(int mouseX, int mouseY, float partialTicks) public void drawScreen(int mouseX, int mouseY, float partialTicks)
{ {
DrawUtils.drawImage(new ResourceLocation("Athena/menu/test.png"), 0, 0, width, height); DrawUtils.drawImage(new ResourceLocation("Athena/menu/cool_wallpaper.png"), 0, 0, width, height);
int[] size = InputUtils.getWindowsSize(); int[] size = InputUtils.getWindowsSize();
int startX = size[0] / 2; int startX = size[0] / 2;
int startY = size[1] / 2; int startY = size[1] / 2;
int x = startX - 75; int x = startX - 75;
int y = this.height / 4 + 28; int y = this.height / 4 - 5;
int width = 150; int width = 150;
int height = 100; int height = 100;
rip.athena.client.utils.font.FontManager.getNunitoBold(30).drawString(Athena.INSTANCE.getClientName().toUpperCase(), rip.athena.client.utils.font.FontManager.getProductSansBold(60).drawCenteredString(Athena.INSTANCE.getClientName(),
this.width / 2 - 88 + rip.athena.client.utils.font.FontManager.getNunitoBold(30).width(Athena.INSTANCE.getClientName().toUpperCase()), y, new Color(255, 255, 255).getRGB()); this.width / 2, y, new Color(255, 255, 255).getRGB());
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
DrawUtils.drawImage(new ResourceLocation("Athena/menu/exit.png"),startX + startX - 20, 10, 10, 10); DrawUtils.drawImage(new ResourceLocation("Athena/menu/exit.png"),startX + startX - 20, 10, 10, 10);

View File

@ -1,5 +1,9 @@
package rip.athena.client.modules.impl.render; package rip.athena.client.modules.impl.render;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import rip.athena.client.Athena; import rip.athena.client.Athena;
import rip.athena.client.config.ConfigValue; import rip.athena.client.config.ConfigValue;
@ -15,6 +19,8 @@ import java.awt.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import static rip.athena.client.utils.render.DrawUtils.drawCircle;
/** /**
* @author Athena Development * @author Athena Development
* @project Athena-Client * @project Athena-Client
@ -48,6 +54,10 @@ public class Clock extends Module {
@ConfigValue.Boolean(name = "Wave Chroma") @ConfigValue.Boolean(name = "Wave Chroma")
private boolean isUsingWaveChroma = false; private boolean isUsingWaveChroma = false;
private boolean isClock = false;
private int radius = 12;
private HUDElement hud; private HUDElement hud;
private int width = 56; private int width = 56;
private int height = 18; private int height = 18;
@ -69,16 +79,20 @@ public class Clock extends Module {
} }
public void render() { public void render() {
if (mc.gameSettings.showDebugInfo) {
return;
}
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(format); DateTimeFormatter dtf = DateTimeFormatter.ofPattern(format);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
String string = dtf.format(now); String string = dtf.format(now);
if(!isClock) {
if (mc.gameSettings.showDebugInfo) {
return;
}
GL11.glPushMatrix(); GL11.glPushMatrix();
int stringWidth = 0; int stringWidth = 0;
if(customFont) { if (customFont) {
stringWidth = (int) rip.athena.client.utils.font.FontManager.getProductSansRegular(30).width(string); stringWidth = (int) rip.athena.client.utils.font.FontManager.getProductSansRegular(30).width(string);
} else { } else {
stringWidth = mc.fontRendererObj.getStringWidth(string); stringWidth = mc.fontRendererObj.getStringWidth(string);
@ -87,9 +101,9 @@ public class Clock extends Module {
int width = hud.getWidth(); int width = hud.getWidth();
int height = hud.getHeight(); int height = hud.getHeight();
if(backGround) { if (backGround) {
if(backgroundMode.equalsIgnoreCase("Modern")) { if (backgroundMode.equalsIgnoreCase("Modern")) {
if(Athena.INSTANCE.getThemeManager().getTheme().isTriColor()) { if (Athena.INSTANCE.getThemeManager().getTheme().isTriColor()) {
RoundedUtils.drawGradientRound(hud.getX(), hud.getY(), hud.getWidth(), hud.getHeight(), 6, Athena.INSTANCE.getThemeManager().getTheme().getFirstColor(), Athena.INSTANCE.getThemeManager().getTheme().getSecondColor(), Athena.INSTANCE.getThemeManager().getTheme().getThirdColor(), Athena.INSTANCE.getThemeManager().getTheme().getFirstColor()); RoundedUtils.drawGradientRound(hud.getX(), hud.getY(), hud.getWidth(), hud.getHeight(), 6, Athena.INSTANCE.getThemeManager().getTheme().getFirstColor(), Athena.INSTANCE.getThemeManager().getTheme().getSecondColor(), Athena.INSTANCE.getThemeManager().getTheme().getThirdColor(), Athena.INSTANCE.getThemeManager().getTheme().getFirstColor());
} else { } else {
RoundedUtils.drawGradientRound(hud.getX(), hud.getY(), hud.getWidth(), hud.getHeight(), 6, Athena.INSTANCE.getThemeManager().getTheme().getFirstColor(), Athena.INSTANCE.getThemeManager().getTheme().getFirstColor(), Athena.INSTANCE.getThemeManager().getTheme().getSecondColor(), Athena.INSTANCE.getThemeManager().getTheme().getSecondColor()); RoundedUtils.drawGradientRound(hud.getX(), hud.getY(), hud.getWidth(), hud.getHeight(), 6, Athena.INSTANCE.getThemeManager().getTheme().getFirstColor(), Athena.INSTANCE.getThemeManager().getTheme().getFirstColor(), Athena.INSTANCE.getThemeManager().getTheme().getSecondColor(), Athena.INSTANCE.getThemeManager().getTheme().getSecondColor());
@ -99,38 +113,53 @@ public class Clock extends Module {
} else if (backgroundMode.equalsIgnoreCase("Fade")) { } else if (backgroundMode.equalsIgnoreCase("Fade")) {
RoundedUtils.drawRoundedRect(hud.getX(), hud.getY(), hud.getX() + width, hud.getY() + height, 8.0f, Athena.INSTANCE.getThemeManager().getTheme().getAccentColor().getRGB()); RoundedUtils.drawRoundedRect(hud.getX(), hud.getY(), hud.getX() + width, hud.getY() + height, 8.0f, Athena.INSTANCE.getThemeManager().getTheme().getAccentColor().getRGB());
} else { } else {
RoundedUtils.drawRoundedRect(hud.getX(), hud.getY(), hud.getX() + width, hud.getY() + height, 12,background.getRGB()); RoundedUtils.drawRoundedRect(hud.getX(), hud.getY(), hud.getX() + width, hud.getY() + height, 12, background.getRGB());
} }
} }
float posY = hud.getY() + 2; float posY = hud.getY() + 2;
float posX = hud.getX() + 9; float posX = hud.getX() + 9;
if(customFont) { if (customFont) {
hud.setWidth((int)rip.athena.client.utils.font.FontManager.getProductSansRegular(25).width(string) + 16); hud.setWidth((int) rip.athena.client.utils.font.FontManager.getProductSansRegular(25).width(string) + 16);
hud.setHeight((int) FontManager.getProductSansRegular(25).height()); hud.setHeight((int) FontManager.getProductSansRegular(25).height());
if(isUsingStaticChroma) { if (isUsingStaticChroma) {
DrawUtils.drawCustomFontChromaString(rip.athena.client.utils.font.FontManager.getProductSansRegular(25), string, (int) (posX), (int) posY, true, true); DrawUtils.drawCustomFontChromaString(rip.athena.client.utils.font.FontManager.getProductSansRegular(25), string, (int) (posX), (int) posY, true, true);
} else if(isUsingWaveChroma) { } else if (isUsingWaveChroma) {
DrawUtils.drawCustomFontChromaString(rip.athena.client.utils.font.FontManager.getProductSansRegular(25), string, (int) (posX), (int) posY, false, true); DrawUtils.drawCustomFontChromaString(rip.athena.client.utils.font.FontManager.getProductSansRegular(25), string, (int) (posX), (int) posY, false, true);
} else { } else {
rip.athena.client.utils.font.FontManager.getProductSansRegular(25).drawString(string,(int) (posX), (int)posY, color.getRGB()); rip.athena.client.utils.font.FontManager.getProductSansRegular(25).drawString(string, (int) (posX), (int) posY, color.getRGB());
} }
} else { } else {
hud.setWidth(mc.fontRendererObj.getStringWidth(string) + 16); hud.setWidth(mc.fontRendererObj.getStringWidth(string) + 16);
hud.setHeight(mc.fontRendererObj.FONT_HEIGHT + 9); hud.setHeight(mc.fontRendererObj.FONT_HEIGHT + 9);
if(isUsingStaticChroma) { if (isUsingStaticChroma) {
DrawUtils.drawChromaString(string, posX, posY + 3, true ,true); DrawUtils.drawChromaString(string, posX, posY + 3, true, true);
} else if(isUsingWaveChroma) { } else if (isUsingWaveChroma) {
DrawUtils.drawChromaString(string, posX, posY + 3, false ,true); DrawUtils.drawChromaString(string, posX, posY + 3, false, true);
} else { } else {
mc.fontRendererObj.drawStringWithShadow(string, (float) (posX), (float) posY+ 3, color.getRGB()); mc.fontRendererObj.drawStringWithShadow(string, (float) (posX), (float) posY + 3, color.getRGB());
} }
} }
GL11.glColor3f(1, 1, 1); GL11.glColor3f(1, 1, 1);
GL11.glPopMatrix(); GL11.glPopMatrix();
} else {
drawCircle(hud.getX(), hud.getY(), radius, new Color(39, 55, 77).getRGB(), radius * 2, true);
drawCircle((float) (hud.getX() + 0.1), (float) (hud.getY() + 0.1), radius - 5, new Color(82, 109, 130).getRGB(), radius - 5 * 2, true);
double conv = 20 / 100.0 * Math.PI * 2.0 + Math.PI;
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex2d(0, 0);
GL11.glVertex2d(-hud.getX() + -radius * Math.sin(conv), -hud.getY() + radius * Math.cos(conv));
GL11.glEnd();
} }
}
} }

View File

@ -15,5 +15,4 @@ public abstract class Font {
public abstract float height(); public abstract float height();
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 MiB