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
*/
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)
{

View File

@ -109,14 +109,22 @@ public class GuiButton extends Gui
if(opacity > 120) opacity = 120;
} else {
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.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)) {
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
{
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);
}
}

View File

@ -4,6 +4,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import java.awt.*;
public class GuiSlider extends GuiButton
{
private float sliderPosition = 1.0F;
@ -87,8 +89,10 @@ public class GuiSlider extends GuiButton
}
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());
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.drawRoundedRect(menu.getX(), menu.getY(), menu.getX() + menu.getWidth(), menu.getY() + menu.getHeight(), 64, Athena.INSTANCE.getThemeManager().getPrimaryTheme().getFirstColor());
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(), 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);

View File

@ -74,9 +74,9 @@ public class ModCategoryButton extends MenuButton {
if(Settings.customGuiFont) {
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 {
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 {
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;
if (this.mc.isDemo())
{
this.addDemoButtons(j, 24);
}
else
{
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(4, this.width / 2 + 2, j + 72 + 12, 98, 20, "Store"));
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 - 24, 98, 20, "Store"));
}
@ -204,28 +200,15 @@ 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(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()));
}
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;
}
// 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()));
}
protected void actionPerformed(GuiButton button) throws IOException
{
if (button.id == 0)
{
this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
}
this.mc.displayGuiScreen(new GuiOptions(this, this.mc.gameSettings));
}
if (button.id == 5)
{
@ -310,19 +293,19 @@ public class AthenaMenu extends GuiScreen implements GuiYesNoCallback
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 startX = size[0] / 2;
int startY = size[1] / 2;
int x = startX - 75;
int y = this.height / 4 + 28;
int y = this.height / 4 - 5;
int width = 150;
int height = 100;
rip.athena.client.utils.font.FontManager.getNunitoBold(30).drawString(Athena.INSTANCE.getClientName().toUpperCase(),
this.width / 2 - 88 + rip.athena.client.utils.font.FontManager.getNunitoBold(30).width(Athena.INSTANCE.getClientName().toUpperCase()), y, new Color(255, 255, 255).getRGB());
rip.athena.client.utils.font.FontManager.getProductSansBold(60).drawCenteredString(Athena.INSTANCE.getClientName(),
this.width / 2, y, new Color(255, 255, 255).getRGB());
GlStateManager.pushMatrix();
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;
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 rip.athena.client.Athena;
import rip.athena.client.config.ConfigValue;
@ -15,6 +19,8 @@ import java.awt.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import static rip.athena.client.utils.render.DrawUtils.drawCircle;
/**
* @author Athena Development
* @project Athena-Client
@ -23,7 +29,7 @@ import java.time.format.DateTimeFormatter;
public class Clock extends Module {
@ConfigValue.Color(name = "Color")
private Color color = Color.WHITE;
@ConfigValue.List(name = "Clock Format", values = {"yyyy/MM/dd HH:mm:ss","MM/dd/yyyy", "dd/MM/yyyy", "dd/MM/yyyy hh:mm a" , "MM/dd/yyyy hh:mm a" ,"E, MMM dd yyyy","hh:mm a", "hh:mm:ss a", "yyyy-MM-dd"})
private String format = "yyyy/MM/dd HH:mm:ss";
@ -32,7 +38,7 @@ public class Clock extends Module {
@ConfigValue.Boolean(name = "Background")
private boolean backGround = true;
@ConfigValue.Color(name = "Background Color")
private Color background = new Color(0, 0, 0, 150);
@ -41,96 +47,119 @@ public class Clock extends Module {
@ConfigValue.Boolean(name = "Custom Font")
private boolean customFont = false;
@ConfigValue.Boolean(name = "Static Chroma")
private boolean isUsingStaticChroma = false;
@ConfigValue.Boolean(name = "Wave Chroma")
private boolean isUsingWaveChroma = false;
private boolean isClock = false;
private int radius = 12;
private HUDElement hud;
private int width = 56;
private int height = 18;
public Clock() {
super("Clock", Category.RENDER, "Athena/gui/mods/time.png");
hud = new HUDElement("time", width, height) {
@Override
public void onRender() {
render();
}
};
hud.setX(1);
hud.setY(190);
addHUD(hud);
}
public void render() {
if (mc.gameSettings.showDebugInfo) {
return;
}
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(format);
LocalDateTime now = LocalDateTime.now();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern(format);
LocalDateTime now = LocalDateTime.now();
String string = dtf.format(now);
GL11.glPushMatrix();
int stringWidth = 0;
if(customFont) {
stringWidth = (int) rip.athena.client.utils.font.FontManager.getProductSansRegular(30).width(string);
} else {
stringWidth = mc.fontRendererObj.getStringWidth(string);
}
int width = hud.getWidth();
int height = hud.getHeight();
if(backGround) {
if(backgroundMode.equalsIgnoreCase("Modern")) {
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());
if(!isClock) {
if (mc.gameSettings.showDebugInfo) {
return;
}
GL11.glPushMatrix();
int stringWidth = 0;
if (customFont) {
stringWidth = (int) rip.athena.client.utils.font.FontManager.getProductSansRegular(30).width(string);
} else {
stringWidth = mc.fontRendererObj.getStringWidth(string);
}
int width = hud.getWidth();
int height = hud.getHeight();
if (backGround) {
if (backgroundMode.equalsIgnoreCase("Modern")) {
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());
} 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());
}
} else if (backgroundMode.equalsIgnoreCase("Circle")) {
RoundedUtils.drawGradientRound(hud.getX(), hud.getY(), hud.getWidth(), hud.getHeight(), 6, ColorUtil.getClientColor(0, transparency), ColorUtil.getClientColor(90, transparency), ColorUtil.getClientColor(180, transparency), ColorUtil.getClientColor(270, transparency));
} 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());
} 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.drawRoundedRect(hud.getX(), hud.getY(), hud.getX() + width, hud.getY() + height, 12, background.getRGB());
}
} else if (backgroundMode.equalsIgnoreCase("Circle")) {
RoundedUtils.drawGradientRound(hud.getX(), hud.getY(), hud.getWidth(), hud.getHeight(), 6, ColorUtil.getClientColor(0, transparency), ColorUtil.getClientColor(90, transparency), ColorUtil.getClientColor(180, transparency), ColorUtil.getClientColor(270, transparency));
} 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());
} else {
RoundedUtils.drawRoundedRect(hud.getX(), hud.getY(), hud.getX() + width, hud.getY() + height, 12,background.getRGB());
}
}
float posY = hud.getY() + 2;
float posX = hud.getX() + 9;
if(customFont) {
hud.setWidth((int)rip.athena.client.utils.font.FontManager.getProductSansRegular(25).width(string) + 16);
hud.setHeight((int) FontManager.getProductSansRegular(25).height());
if(isUsingStaticChroma) {
DrawUtils.drawCustomFontChromaString(rip.athena.client.utils.font.FontManager.getProductSansRegular(25), string, (int) (posX), (int) posY, true, true);
} else if(isUsingWaveChroma) {
DrawUtils.drawCustomFontChromaString(rip.athena.client.utils.font.FontManager.getProductSansRegular(25), string, (int) (posX), (int) posY, false, true);
} else {
rip.athena.client.utils.font.FontManager.getProductSansRegular(25).drawString(string,(int) (posX), (int)posY, color.getRGB());
}
} else {
hud.setWidth(mc.fontRendererObj.getStringWidth(string) + 16);
hud.setHeight(mc.fontRendererObj.FONT_HEIGHT + 9);
if(isUsingStaticChroma) {
DrawUtils.drawChromaString(string, posX, posY + 3, true ,true);
} else if(isUsingWaveChroma) {
DrawUtils.drawChromaString(string, posX, posY + 3, false ,true);
float posY = hud.getY() + 2;
float posX = hud.getX() + 9;
if (customFont) {
hud.setWidth((int) rip.athena.client.utils.font.FontManager.getProductSansRegular(25).width(string) + 16);
hud.setHeight((int) FontManager.getProductSansRegular(25).height());
if (isUsingStaticChroma) {
DrawUtils.drawCustomFontChromaString(rip.athena.client.utils.font.FontManager.getProductSansRegular(25), string, (int) (posX), (int) posY, true, true);
} else if (isUsingWaveChroma) {
DrawUtils.drawCustomFontChromaString(rip.athena.client.utils.font.FontManager.getProductSansRegular(25), string, (int) (posX), (int) posY, false, true);
} else {
rip.athena.client.utils.font.FontManager.getProductSansRegular(25).drawString(string, (int) (posX), (int) posY, color.getRGB());
}
} else {
mc.fontRendererObj.drawStringWithShadow(string, (float) (posX), (float) posY+ 3, color.getRGB());
hud.setWidth(mc.fontRendererObj.getStringWidth(string) + 16);
hud.setHeight(mc.fontRendererObj.FONT_HEIGHT + 9);
if (isUsingStaticChroma) {
DrawUtils.drawChromaString(string, posX, posY + 3, true, true);
} else if (isUsingWaveChroma) {
DrawUtils.drawChromaString(string, posX, posY + 3, false, true);
} else {
mc.fontRendererObj.drawStringWithShadow(string, (float) (posX), (float) posY + 3, color.getRGB());
}
}
GL11.glColor3f(1, 1, 1);
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();
}
GL11.glColor3f(1, 1, 1);
GL11.glPopMatrix();
}
}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 MiB