From b3b0e35f09c402a7e025e6e1a682fba9d51d025c Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Fri, 7 Jul 2023 19:54:05 +0600 Subject: [PATCH] Theme --- .../client/cosmetics/gui/CosmeticsGui.java | 72 ++- .../client/gui/clickgui/ClickGUI.java | 90 ++-- .../client/gui/clickgui/GuiColorPicker.java | 33 +- .../client/gui/clickgui/ModSettings.java | 29 +- .../client/gui/clickgui/PlusColorPicker.java | 162 ------- .../client/gui/clickgui/TabButton.java | 79 ---- .../client/gui/elements/Button.java | 62 ++- .../client/gui/elements/Checkbox.java | 12 +- .../client/gui/elements/ColorPicker.java | 4 +- .../client/gui/elements/IconButton.java | 43 +- .../client/gui/elements/Input.java | 22 +- .../client/gui/elements/StaticButton.java | 20 +- .../client/gui/elements/Switch.java | 18 +- .../gui/friends/FriendsListOverlay.java | 46 +- .../client/gui/notification/Notification.java | 2 +- .../silentclient/client/gui/theme/Theme.java | 4 + .../gui/theme/button/DefaultButtonTheme.java | 26 ++ .../client/gui/theme/button/IButtonTheme.java | 10 + .../gui/theme/button/SelectedButtonTheme.java | 25 ++ .../gui/theme/buttonthemes/IButtonSchema.java | 7 - .../theme/checkbox/DefaultCheckboxTheme.java | 15 + .../gui/theme/checkbox/ICheckboxTheme.java | 8 + .../gui/theme/input/DefaultInputTheme.java | 20 + .../client/gui/theme/input/IInputTheme.java | 9 + .../theme/switches/DefaultSwitchTheme.java | 30 ++ .../gui/theme/switches/ISwitchSchema.java | 11 + .../client/gui/util/RenderUtil.java | 411 ++---------------- .../client/gui/util/RoundedUtils.java | 402 ----------------- .../client/mods/ModDraggable.java | 4 +- .../client/mods/hud/MouseStrokesMod.java | 2 +- .../client/mods/render/CrosshairMod.java | 6 +- .../client/premium/PremiumGui.java | 25 +- .../silentclient/client/utils/FileUtils.java | 18 +- 33 files changed, 460 insertions(+), 1267 deletions(-) delete mode 100644 src/main/java/net/silentclient/client/gui/clickgui/PlusColorPicker.java delete mode 100644 src/main/java/net/silentclient/client/gui/clickgui/TabButton.java create mode 100644 src/main/java/net/silentclient/client/gui/theme/button/DefaultButtonTheme.java create mode 100644 src/main/java/net/silentclient/client/gui/theme/button/IButtonTheme.java create mode 100644 src/main/java/net/silentclient/client/gui/theme/button/SelectedButtonTheme.java delete mode 100644 src/main/java/net/silentclient/client/gui/theme/buttonthemes/IButtonSchema.java create mode 100644 src/main/java/net/silentclient/client/gui/theme/checkbox/DefaultCheckboxTheme.java create mode 100644 src/main/java/net/silentclient/client/gui/theme/checkbox/ICheckboxTheme.java create mode 100644 src/main/java/net/silentclient/client/gui/theme/input/DefaultInputTheme.java create mode 100644 src/main/java/net/silentclient/client/gui/theme/input/IInputTheme.java create mode 100644 src/main/java/net/silentclient/client/gui/theme/switches/DefaultSwitchTheme.java create mode 100644 src/main/java/net/silentclient/client/gui/theme/switches/ISwitchSchema.java delete mode 100644 src/main/java/net/silentclient/client/gui/util/RoundedUtils.java diff --git a/src/main/java/net/silentclient/client/cosmetics/gui/CosmeticsGui.java b/src/main/java/net/silentclient/client/cosmetics/gui/CosmeticsGui.java index d584fed..f50b773 100644 --- a/src/main/java/net/silentclient/client/cosmetics/gui/CosmeticsGui.java +++ b/src/main/java/net/silentclient/client/cosmetics/gui/CosmeticsGui.java @@ -12,7 +12,6 @@ import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.animation.SimpleAnimation; -import net.silentclient.client.gui.clickgui.TabButton; import net.silentclient.client.gui.clickgui.utils.MouseUtils; import net.silentclient.client.gui.clickgui.utils.MouseUtils.Scroll; import net.silentclient.client.gui.elements.Button; @@ -20,9 +19,10 @@ import net.silentclient.client.gui.elements.Input; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.gui.util.RenderUtil; -import net.silentclient.client.gui.util.RoundedUtils; import net.silentclient.client.mods.settings.CosmeticsMod; import net.silentclient.client.mods.settings.GeneralMod; +import net.silentclient.client.gui.theme.button.DefaultButtonTheme; +import net.silentclient.client.gui.theme.button.SelectedButtonTheme; import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.Sounds; import net.silentclient.client.utils.types.PlayerResponse.Account.Cosmetics.CosmeticItem; @@ -60,27 +60,27 @@ public class CosmeticsGui extends SilentScreen { int height = addY * 2; int tabId = 1; - this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Capes", selectedCategory == "capes")); + this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Capes", false, selectedCategory == "capes" ? new SelectedButtonTheme() : new DefaultButtonTheme())); categoryOffsetY +=20; tabId++; - this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Wings", selectedCategory == "wings")); + this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Wings", false, selectedCategory == "wings" ? new SelectedButtonTheme() : new DefaultButtonTheme())); categoryOffsetY +=20; tabId++; - this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Bandanas", selectedCategory == "bandanas")); + this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Bandanas", false, selectedCategory == "bandanas" ? new SelectedButtonTheme() : new DefaultButtonTheme())); categoryOffsetY +=20; tabId++; - this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Hats", selectedCategory == "hats")); + this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Hats", false, selectedCategory == "hats" ? new SelectedButtonTheme() : new DefaultButtonTheme())); categoryOffsetY +=20; tabId++; - this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Shields", selectedCategory == "shields")); + this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Shields", false, selectedCategory == "shields" ? new SelectedButtonTheme() : new DefaultButtonTheme())); categoryOffsetY +=20; tabId++; - this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 15, "Icons", selectedCategory == "icons")); + this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 15, "Icons", false, selectedCategory == "icons" ? new SelectedButtonTheme() : new DefaultButtonTheme())); tabId++; this.buttonList.add(new Button(tabId, x + 5, (y + height) - 26, 75, 20, "Store")); @@ -97,43 +97,70 @@ public class CosmeticsGui extends SilentScreen { @Override protected void actionPerformed(GuiButton button) throws IOException { super.actionPerformed(button); - - if(button instanceof TabButton) { - TabButton tab = (TabButton) button; - switch (tab.id) { + if(button instanceof Button) { + switch (button.id) { case 1: + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); selectedCategory = "capes"; rotate = 144; break; case 2: + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); selectedCategory = "wings"; rotate = 144; break; case 3: + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); selectedCategory = "bandanas"; rotate = 340; break; case 4: + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); selectedCategory = "hats"; rotate = 340; break; case 5: + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); selectedCategory = "shields"; rotate = 340; break; case 6: + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); selectedCategory = "icons"; break; } - this.buttonList.forEach(oldButton -> { - if(oldButton instanceof TabButton) { - TabButton tabB = (TabButton) oldButton; - tabB.selected = false; - } - }); this.silentInputs.get(0).setValue(""); - tab.selected = true; scrollY = 0; } @@ -221,7 +248,7 @@ public class CosmeticsGui extends SilentScreen { int modIndex = 1; //Draw background - RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB()); + RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB()); ArrayList items = null; ArrayList selected_item = new ArrayList<>(); @@ -267,7 +294,7 @@ public class CosmeticsGui extends SilentScreen { GL11.glScissor(x * s, translatedY * s, width * s, (height - 25) * s); if(items != null) { for(CosmeticItem m : items) { - RoundedUtils.drawRoundedOutline(x + 100, y + modOffsetY + scrollAnimation.getValue(), x + 100 + 135, y + modOffsetY + scrollAnimation.getValue() + 28, 10, 2, selected_item.contains(m.getId()) ? new Color(32, 252, 3).getRGB() : new Color(252, 3, 3).getRGB()); + RenderUtil.drawRoundedOutline(x + 100, y + modOffsetY + scrollAnimation.getValue(), 135, 28, 10, 2, selected_item.contains(m.getId()) ? new Color(32, 252, 3).getRGB() : new Color(252, 3, 3).getRGB()); GL11.glDisable((int) 2929); GL11.glEnable((int) 3042); @@ -310,9 +337,6 @@ public class CosmeticsGui extends SilentScreen { super.drawScreen(mouseX, mouseY, partialTicks); - RenderUtil.drawRoundedOutline(x + 5, (y + height) - 26, x + 5 + 75, ((y + height) - 26) + 20, 5, 2, -1); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - Client.getInstance().getSilentFontRenderer().drawCenteredString("Store", x + 5 + (75 / 2), ((y + height) - 20) - 3, 14, SilentFontRenderer.FontType.TITLE); if(mc.thePlayer == null && can_show && selectedCategory != "icons") { Client.getInstance().getSilentFontRenderer().drawString("Preview not available", x + 100 + 160, y + 100 - 3, 14, SilentFontRenderer.FontType.TITLE); } diff --git a/src/main/java/net/silentclient/client/gui/clickgui/ClickGUI.java b/src/main/java/net/silentclient/client/gui/clickgui/ClickGUI.java index fa71f69..9b9a399 100644 --- a/src/main/java/net/silentclient/client/gui/clickgui/ClickGUI.java +++ b/src/main/java/net/silentclient/client/gui/clickgui/ClickGUI.java @@ -1,28 +1,13 @@ package net.silentclient.client.gui.clickgui; -import java.awt.Color; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.util.ArrayList; -import java.util.regex.Pattern; - -import net.silentclient.client.gui.SilentScreen; -import net.silentclient.client.utils.MenuBlurUtils; -import org.lwjgl.Sys; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Util; import net.silentclient.client.Client; import net.silentclient.client.config.AddConfigModal; +import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.animation.normal.Animation; import net.silentclient.client.gui.animation.normal.Direction; @@ -38,13 +23,26 @@ import net.silentclient.client.gui.hud.HUDConfigScreen; import net.silentclient.client.gui.notification.NotificationManager; import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.gui.util.RenderUtil; -import net.silentclient.client.gui.util.RoundedUtils; import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.settings.GeneralMod; import net.silentclient.client.premium.PremiumGui; +import net.silentclient.client.gui.theme.button.DefaultButtonTheme; +import net.silentclient.client.gui.theme.button.SelectedButtonTheme; import net.silentclient.client.utils.ColorUtils; +import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.Sounds; +import org.lwjgl.Sys; +import org.lwjgl.input.Keyboard; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.regex.Pattern; public class ClickGUI extends SilentScreen { private ModCategory selectedCategory; @@ -89,7 +87,7 @@ public class ClickGUI extends SilentScreen { String formattedName = c.toString(); - this.buttonList.add(new TabButton(tabId, x + 5, y + categoryOffsetY, 75, 20, formattedName, selectedCategory == c)); + this.buttonList.add(new Button(tabId, x + 5, y + categoryOffsetY, 75, 20, formattedName, false, selectedCategory == c ? new SelectedButtonTheme() : new DefaultButtonTheme())); categoryOffsetY +=25; tabId++; @@ -113,7 +111,7 @@ public class ClickGUI extends SilentScreen { //Draw background GlStateManager.pushMatrix(); GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) introAnimation.getValue()); - RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB()); + RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB()); Client.getInstance().getSilentFontRenderer().drawString(selectedCategory.toString(), x + 100, (int) (y + 5), 14, SilentFontRenderer.FontType.TITLE); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_SCISSOR_TEST); @@ -131,8 +129,8 @@ public class ClickGUI extends SilentScreen { float switchY = y + modOffsetY - scrollAnimation.getValue() + 55; boolean switchHovered = selectedCategory.equals(ModCategory.MODS) && Switch.isHovered(mouseX, mouseY, switchX, switchY) && !headerHovered; boolean isHovered = MouseUtils.isInside(mouseX, mouseY, modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70) && !headerHovered && !switchHovered && (Client.getInstance().getSettingsManager().getSettingByMod(m).size() != 0 || m.getName() == "Auto Text"); - RoundedUtils.drawRoundedOutline(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), modOffsetX + 65, y + modOffsetY - scrollAnimation.getValue() + 70, 5, 2, new Color(255, 255, 255, 127).getRGB()); - RoundedUtils.drawRoundedRect(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), modOffsetX + 65, y + modOffsetY - scrollAnimation.getValue() + 70, 5, new Color(255, 255, 255, isHovered ? 30 : 0).getRGB()); + RenderUtil.drawRoundedOutline(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70, 3, 1, Theme.borderColor().getRGB()); + RenderUtil.drawRoundedRect(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70, 3, new Color(255, 255, 255, isHovered ? 30 : 0).getRGB()); GL11.glColor4f(1, 1, 1, 1); Client.getInstance().getSilentFontRenderer().drawString(m.getName(), modOffsetX + ((65 / 2) - ((Client.getInstance().getSilentFontRenderer().getStringWidth(m.getName(), 8, FontType.HEADER)) / 2)), y + modOffsetY - scrollAnimation.getValue() + 4, 8, FontType.HEADER); if(m.getIcon() != null) { @@ -149,7 +147,7 @@ public class ClickGUI extends SilentScreen { } float badgeX = modOffsetX + ((65 / 2) - 15); float badgeY = y + modOffsetY - scrollAnimation.getValue() + 13; - RenderUtil.drawRoundedRect(badgeX, badgeY, badgeX + 30, badgeY + 8, 8, Color.RED.getRGB()); + RenderUtil.drawRoundedRect(badgeX, badgeY, 30, 8, 8, Color.RED.getRGB()); Client.getInstance().getSilentFontRenderer().drawString(status, badgeX + (status.equals("UPDATED") ? 3 : 9), badgeY + 1, 6, SilentFontRenderer.FontType.HEADER); } @@ -159,21 +157,21 @@ public class ClickGUI extends SilentScreen { column = column == 4 ? 1 : column + 1; } } else if(selectedCategory == ModCategory.CONFIGS) { - RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, -1); + RenderUtil.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28, 10, 2, -1); Client.getInstance().getSilentFontRenderer().drawString("New Config", x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE); modOffsetY+=column == 1 ? 0 : 35; this.scrollHeight += column == 2 ? 28 : 0; column = column == 1 ? 2 : 1; - RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, -1); + RenderUtil.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28, 10, 2, -1); Client.getInstance().getSilentFontRenderer().drawString("Open Folder", x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE); modOffsetY+=column == 1 ? 0 : 35; this.scrollHeight += column == 2 ? 28 : 0; column = column == 1 ? 2 : 1; - RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, new Color(32, 252, 3).getRGB()); + RenderUtil.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28, 10, 2, new Color(32, 252, 3).getRGB()); RenderUtil.drawImage(new ResourceLocation("silentclient/transparent.png"), x + 90 + (column == 1 ? 0 : 130) + (column == 1 ? 125 : 135), y + modOffsetY + 7 - scrollAnimation.getValue(), 15, 15, false); ColorUtils.setColor(new Color(255, 255, 255).getRGB()); Client.getInstance().getSilentFontRenderer().drawString(Client.getInstance().configManager.configFile.getName().replace(".txt", ""), x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE, 45); @@ -185,7 +183,7 @@ public class ClickGUI extends SilentScreen { if(config.equals(".config-settings.txt") || config.equals(".DS_Store") || Client.getInstance().configManager.configFile.getName().equals(config)) { continue; } - RoundedUtils.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), x + 100 + (column == 1 ? 0 : 140) + 135, y + modOffsetY - scrollAnimation.getValue() + 28, 10, 2, new Color(252, 3, 3).getRGB()); + RenderUtil.drawRoundedOutline(x + 100 + (column == 1 ? 0 : 140), y + modOffsetY - scrollAnimation.getValue(), 135, 28, 10, 2, new Color(252, 3, 3).getRGB()); RenderUtil.drawImage(new ResourceLocation("silentclient/icons/trash-icon.png"), x + 90 + (column == 1 ? 0 : 130) + (column == 1 ? 125 : 135), y + modOffsetY + 7 - scrollAnimation.getValue(), 15, 15, false); ColorUtils.setColor(new Color(255, 255, 255).getRGB()); Client.getInstance().getSilentFontRenderer().drawString(config.replace(".txt", ""), x + 110 + (column == 1 ? 0 : 140), y + modOffsetY + 7 - (int) scrollAnimation.getValue(), 14, SilentFontRenderer.FontType.TITLE, 45); @@ -262,32 +260,48 @@ public class ClickGUI extends SilentScreen { @Override protected void actionPerformed(GuiButton button) throws IOException { - if(button instanceof TabButton) { - TabButton tab = (TabButton) button; - switch(tab.id) { + scrollY = 0; + if(button instanceof Button) { + switch(button.id) { case 1: + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); selectedCategory = ModCategory.MODS; break; case 2: + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); selectedCategory = ModCategory.SETTINGS; break; case 3: + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); selectedCategory = ModCategory.CONFIGS; break; case 4: + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); selectedCategory = ModCategory.PLUS; break; } - scrollY = 0; - this.buttonList.forEach(oldButton -> { - if(oldButton instanceof TabButton) { - TabButton tabB = (TabButton) oldButton; - tabB.selected = false; - } - }); - tab.selected = true; - Client.getInstance().configManager.save(); } + Client.getInstance().configManager.save(); if(button.id == 5) { mc.displayGuiScreen(new HUDConfigScreen(this)); diff --git a/src/main/java/net/silentclient/client/gui/clickgui/GuiColorPicker.java b/src/main/java/net/silentclient/client/gui/clickgui/GuiColorPicker.java index 94e5055..f27aef0 100644 --- a/src/main/java/net/silentclient/client/gui/clickgui/GuiColorPicker.java +++ b/src/main/java/net/silentclient/client/gui/clickgui/GuiColorPicker.java @@ -1,37 +1,32 @@ package net.silentclient.client.gui.clickgui; -import java.awt.Color; -import java.io.IOException; -import java.util.ArrayList; - import net.minecraft.client.gui.GuiButton; -import net.minecraft.util.MathHelper; -import net.silentclient.client.gui.elements.Button; -import net.silentclient.client.gui.elements.Checkbox; -import net.silentclient.client.gui.elements.Slider; -import net.silentclient.client.gui.theme.Theme; -import net.silentclient.client.mods.Setting; -import net.silentclient.client.mods.settings.GeneralMod; - -import net.silentclient.client.utils.MenuBlurUtils; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; import net.silentclient.client.gui.animation.normal.Direction; import net.silentclient.client.gui.clickgui.utils.GlUtils; import net.silentclient.client.gui.clickgui.utils.MouseUtils; import net.silentclient.client.gui.clickgui.utils.RenderUtils; +import net.silentclient.client.gui.elements.Button; +import net.silentclient.client.gui.elements.Checkbox; +import net.silentclient.client.gui.elements.Slider; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.hud.HUDConfigScreen; +import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.gui.util.RenderUtil; -import net.silentclient.client.gui.util.RoundedUtils; import net.silentclient.client.mods.Mod; +import net.silentclient.client.mods.Setting; +import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.Sounds; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.io.IOException; +import java.util.ArrayList; public class GuiColorPicker extends GuiScreen { private final Mod mod; @@ -100,7 +95,7 @@ public class GuiColorPicker extends GuiScreen { int height = addY * 2; GlStateManager.pushMatrix(); GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue()); - RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB()); + RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB()); GL11.glPushMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/net/silentclient/client/gui/clickgui/ModSettings.java b/src/main/java/net/silentclient/client/gui/clickgui/ModSettings.java index c9b5389..dcb6414 100644 --- a/src/main/java/net/silentclient/client/gui/clickgui/ModSettings.java +++ b/src/main/java/net/silentclient/client/gui/clickgui/ModSettings.java @@ -1,14 +1,5 @@ package net.silentclient.client.gui.clickgui; -import java.io.IOException; -import java.net.URI; - -import net.silentclient.client.gui.SilentScreen; -import net.silentclient.client.utils.MenuBlurUtils; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; @@ -16,33 +7,31 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; +import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.animation.normal.Direction; import net.silentclient.client.gui.clickgui.utils.GlUtils; import net.silentclient.client.gui.clickgui.utils.MouseUtils; import net.silentclient.client.gui.clickgui.utils.MouseUtils.Scroll; -import net.silentclient.client.gui.elements.Button; -import net.silentclient.client.gui.elements.Checkbox; -import net.silentclient.client.gui.elements.ColorPicker; -import net.silentclient.client.gui.elements.Input; -import net.silentclient.client.gui.elements.Select; -import net.silentclient.client.gui.elements.Slider; -import net.silentclient.client.gui.elements.StaticButton; -import net.silentclient.client.gui.elements.Switch; +import net.silentclient.client.gui.elements.*; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.hud.HUDConfigScreen; import net.silentclient.client.gui.notification.NotificationManager; import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.gui.util.RenderUtil; -import net.silentclient.client.gui.util.RoundedUtils; import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.Setting; import net.silentclient.client.mods.render.CrosshairMod; -import net.silentclient.client.mods.settings.GeneralMod; import net.silentclient.client.mods.world.TimeChangerMod; import net.silentclient.client.utils.ColorUtils; +import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.Sounds; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import java.io.IOException; +import java.net.URI; public class ModSettings extends SilentScreen { private final Mod mod; @@ -122,7 +111,7 @@ public class ModSettings extends SilentScreen { GlStateManager.pushMatrix(); GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue()); - RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB()); + RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB()); GL11.glPushMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/net/silentclient/client/gui/clickgui/PlusColorPicker.java b/src/main/java/net/silentclient/client/gui/clickgui/PlusColorPicker.java deleted file mode 100644 index 3ca91b4..0000000 --- a/src/main/java/net/silentclient/client/gui/clickgui/PlusColorPicker.java +++ /dev/null @@ -1,162 +0,0 @@ -package net.silentclient.client.gui.clickgui; - -import java.awt.Color; -import java.io.IOException; -import java.util.ArrayList; - -import net.minecraft.client.gui.GuiButton; -import net.silentclient.client.gui.elements.Button; -import net.silentclient.client.gui.theme.Theme; -import net.silentclient.client.utils.MenuBlurUtils; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.ResourceLocation; -import net.silentclient.client.Client; -import net.silentclient.client.gui.clickgui.utils.MouseUtils; -import net.silentclient.client.gui.clickgui.utils.RenderUtils; -import net.silentclient.client.gui.font.SilentFontRenderer; -import net.silentclient.client.gui.hud.HUDConfigScreen; -import net.silentclient.client.gui.util.RenderUtil; -import net.silentclient.client.gui.util.RoundedUtils; -import net.silentclient.client.mods.settings.GeneralMod; -import net.silentclient.client.utils.Sounds; - -public class PlusColorPicker extends GuiScreen { - private final GuiScreen parentScreen; - private ArrayList colors = new ArrayList(); - - public PlusColorPicker(GuiScreen parent) { - this.parentScreen = parent; - } - - @Override - public void initGui() { - colors.clear(); - colors.add(new Color(255, 255, 255)); - colors.add(new Color(156, 157, 151)); - colors.add(new Color(71,79,82)); - colors.add(new Color(0, 0, 0)); - colors.add(new Color(255,216,61)); - colors.add(new Color(249,128,29)); - colors.add(new Color(176,46,38)); - colors.add(new Color(130,84,50)); - colors.add(new Color(128,199,31)); - colors.add(new Color(58,179,218)); - colors.add(new Color(22,156,157)); - colors.add(new Color(60,68,169)); - colors.add(new Color(243,140,170)); - colors.add(new Color(198,79,189)); - colors.add(new Color(137,50,183)); - MenuBlurUtils.loadBlur(); - int addX = 190; - int addY = 110; - int x = (width / 2) - addX; - int y = (height / 2) - addY; - int height = addY * 2; - this.buttonList.add(new Button(1, x + 5, y + 42, 75, 20, "< Back")); - this.buttonList.add(new Button(2, x + 5, (y + height) - 26, 75, 20, "Edit HUD")); - } - - @Override - public void onGuiClosed() { - MenuBlurUtils.unloadBlur(); - super.onGuiClosed(); - } - - @Override - protected void actionPerformed(GuiButton button) throws IOException { - super.actionPerformed(button); - if(button.id == 1) { - mc.displayGuiScreen(parentScreen); - } - - if(button.id == 2) { - mc.displayGuiScreen(new HUDConfigScreen(this)); - } - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawDefaultBackground(); - - int addX = 190; - int addY = 110; - - int x = (width / 2) - addX; - int y = (height / 2) - addY; - int width = addX * 2; - int height = addY * 2; - - RoundedUtils.drawRoundedRect(x + 90, y, x + 90 + width - 90, y + height, 15, Theme.backgroundColor().getRGB()); - RoundedUtils.drawRoundedRect(x, y, x + 85, y + height, 15, Theme.backgroundColor().getRGB()); - - GL11.glPushMatrix(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - - int settingY = y + 30; - - int colorIndex = 0; - int spacing = 100; - - for(Color color : colors) { - RenderUtils.drawRect(x + spacing, settingY - 1, 22, 22, new Color(0, 0, 0).getRGB()); - RenderUtils.drawRect(x + spacing + 1, settingY - 1 + 1, 20, 20, color.getRGB()); - spacing += 25; - colorIndex += 1; - if(colorIndex == 5 || colorIndex == 10) { - spacing = 100; - settingY += 30; - } - } - - - GL11.glPopMatrix(); - - RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo_small.png"), x + (85 / 3), y + 5, 30, 30); - - Client.getInstance().getSilentFontRenderer().drawString("Choose a color", x + 100, y + 10 - 3, 15, SilentFontRenderer.FontType.TITLE); - - super.drawScreen(mouseX, mouseY, partialTicks); - } - - @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - // TODO Auto-generated method stub - super.mouseClicked(mouseX, mouseY, mouseButton); - - int addX = 190; - int addY = 110; - - int x = (width / 2) - addX; - int y = (height / 2) - addY; - int settingY = y + 30; - int colorIndex = 0; - int spacing = 100; - - for(Color color : colors) { - if(MouseUtils.isInside(mouseX, mouseY, x + spacing, settingY - 1, 22, 22) && mouseButton == 0) { - Sounds.playButtonSound(); - Client.getInstance().getAccount().setPlusIconColor(color.getRGB()); - mc.displayGuiScreen(parentScreen); - } - spacing += 25; - colorIndex += 1; - if(colorIndex == 5 || colorIndex == 10) { - spacing = 100; - settingY += 30; - } - } - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - if (keyCode == Keyboard.KEY_ESCAPE) { - Sounds.playButtonSound(); - mc.displayGuiScreen(parentScreen); - } - } -} diff --git a/src/main/java/net/silentclient/client/gui/clickgui/TabButton.java b/src/main/java/net/silentclient/client/gui/clickgui/TabButton.java deleted file mode 100644 index f861d22..0000000 --- a/src/main/java/net/silentclient/client/gui/clickgui/TabButton.java +++ /dev/null @@ -1,79 +0,0 @@ -package net.silentclient.client.gui.clickgui; - -import java.awt.Color; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.SoundHandler; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.renderer.GlStateManager; -import net.silentclient.client.Client; -import net.silentclient.client.gui.font.SilentFontRenderer; -import net.silentclient.client.gui.util.RenderUtil; -import net.silentclient.client.mods.settings.GeneralMod; -import net.silentclient.client.utils.ColorUtils; -import net.silentclient.client.utils.TimerUtils; - -public class TabButton extends GuiButton { - private int animatedOpcaity = 0; - - private TimerUtils animateTimer = new TimerUtils(); - public boolean selected = false; - private int fontHeight = 14; - - public TabButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, boolean selected) { - super(buttonId, x, y, widthIn, heightIn, buttonText); - this.selected = selected; - // TODO Auto-generated constructor stub - } - - public TabButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, int fontHeight, boolean selected) { - super(buttonId, x, y, widthIn, heightIn, buttonText); - this.selected = selected; - this.fontHeight = fontHeight; - // TODO Auto-generated constructor stub - } - - - public void drawButton(Minecraft mc, int mouseX, int mouseY) - { - if (this.visible) - { - GlStateManager.disableBlend(); - this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - if (!this.enabled) - { - new Color(255, 255, 255, 50).getRGB(); - } - ColorUtils.setColor(this.enabled ? this.selected ? new Color(255,255,255, 255).getRGB() : new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB()); - RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, (float)xPosition + width, (float)yPosition + height, (float)5, this.enabled ? this.selected ? new Color(255,255,255, 255).getRGB() : new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB()); - ColorUtils.setColor(this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB()); - RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB()); - this.mouseDragged(mc, mouseX, mouseY); - - if (this.hovered && this.enabled) { - if (this.animatedOpcaity < 75 && animateTimer.delay(30)) { - this.animatedOpcaity += 15; - animateTimer.reset(); - } - } else { - if (this.animatedOpcaity != 0 && animateTimer.delay(30)) { - this.animatedOpcaity -= 15; - animateTimer.reset(); - } - } - - ColorUtils.setColor(this.selected ? new Color(0, 0, 0).getRGB() : new Color(255, 255, 255).getRGB()); - Client.getInstance().getSilentFontRenderer().drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - fontHeight) / 2, fontHeight, SilentFontRenderer.FontType.TITLE, width - (fontHeight / 2)); - } else { - this.animatedOpcaity = 0; - } - } - - @Override - public void playPressSound(SoundHandler soundHandlerIn) { - if(!Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Silent Button Sounds").getValBoolean()) { - return; - } - super.playPressSound(soundHandlerIn); - } -} diff --git a/src/main/java/net/silentclient/client/gui/elements/Button.java b/src/main/java/net/silentclient/client/gui/elements/Button.java index 4565a25..50c6e00 100644 --- a/src/main/java/net/silentclient/client/gui/elements/Button.java +++ b/src/main/java/net/silentclient/client/gui/elements/Button.java @@ -10,6 +10,8 @@ import net.silentclient.client.Client; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mods.settings.GeneralMod; +import net.silentclient.client.gui.theme.button.DefaultButtonTheme; +import net.silentclient.client.gui.theme.button.IButtonTheme; import net.silentclient.client.utils.ColorUtils; import net.silentclient.client.utils.TimerUtils; @@ -18,18 +20,29 @@ public class Button extends GuiButton private int animatedOpcaity = 0; private boolean escMenu = false; + private int fontSize; private TimerUtils animateTimer = new TimerUtils(); - - public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, boolean escMenu) { + + private IButtonTheme theme; + + public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, int fontSize, boolean escMenu, IButtonTheme theme) { super(buttonId, x, y, widthIn, heightIn, buttonText); this.escMenu = escMenu; - // TODO Auto-generated constructor stub + this.theme = theme; + this.fontSize = fontSize; } - - public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) { - super(buttonId, x, y, widthIn, heightIn, buttonText); - // TODO Auto-generated constructor stub + + public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, boolean escMenu, IButtonTheme theme) { + this(buttonId, x, y, widthIn, heightIn, buttonText, 14, escMenu, theme); + } + + public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText, boolean escMenu) { + this(buttonId, x, y, widthIn, heightIn, buttonText, escMenu, new DefaultButtonTheme()); + } + + public Button(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) { + this(buttonId, x, y, widthIn, heightIn, buttonText, false); } public Button(int buttonId, int x, int y, String buttonText) @@ -39,8 +52,7 @@ public class Button extends GuiButton public Button(int buttonId, int x, int y, String buttonText, boolean escMenu) { - this(buttonId, x, y, 200, 20, buttonText); - this.escMenu = escMenu; + this(buttonId, x, y, 200, 20, buttonText, escMenu); } public void drawButton(Minecraft mc, int mouseX, int mouseY) @@ -53,14 +65,12 @@ public class Button extends GuiButton { GlStateManager.disableBlend(); this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - if (!this.enabled) - { - new Color(255, 255, 255, 50).getRGB(); - } - ColorUtils.setColor(this.enabled ? new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB()); - RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, (float)xPosition + width, (float)yPosition + height, (float)5, this.enabled ? new Color(255,255,255,animatedOpcaity).getRGB() : new Color(255,255,255,0).getRGB()); - ColorUtils.setColor(this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB()); - RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, this.enabled ? new Color(255,255,255,255).getRGB() : new Color(255,255,255,50).getRGB()); + ColorUtils.setColor(theme.getBackgroundColor().getRGB()); + RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, width, height, (float)3, theme.getBackgroundColor().getRGB()); + ColorUtils.setColor(theme.getHoveredBackgroundColor(this.enabled ? animatedOpcaity : 0).getRGB()); + RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, width, height, (float)3, theme.getHoveredBackgroundColor(this.enabled ? animatedOpcaity : 0).getRGB()); + ColorUtils.setColor(this.enabled ? new Color(214, 213, 210, 255).getRGB() : new Color(255,255,255,50).getRGB()); + RenderUtil.drawRoundedOutline(xPosition, yPosition, width, height, 3, 1, theme.getBorderColor().getRGB()); this.mouseDragged(mc, mouseX, mouseY); if (this.hovered && this.enabled) { @@ -74,12 +84,17 @@ public class Button extends GuiButton animateTimer.reset(); } } - - Client.getInstance().getSilentFontRenderer().drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 14) / 2, 14, SilentFontRenderer.FontType.TITLE, width - 7); + + this.drawButtonContent(); } else { this.animatedOpcaity = 0; } } + + protected void drawButtonContent() { + ColorUtils.setColor(theme.getTextColor().getRGB()); + Client.getInstance().getSilentFontRenderer().drawCenteredString(this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - fontSize) / 2, fontSize, SilentFontRenderer.FontType.TITLE, width - (fontSize / 2)); + } @Override public void playPressSound(SoundHandler soundHandlerIn) { @@ -88,5 +103,12 @@ public class Button extends GuiButton } super.playPressSound(soundHandlerIn); } - + + public void setTheme(IButtonTheme theme) { + this.theme = theme; + } + + public IButtonTheme getTheme() { + return theme; + } } diff --git a/src/main/java/net/silentclient/client/gui/elements/Checkbox.java b/src/main/java/net/silentclient/client/gui/elements/Checkbox.java index 9efb655..43d90e0 100644 --- a/src/main/java/net/silentclient/client/gui/elements/Checkbox.java +++ b/src/main/java/net/silentclient/client/gui/elements/Checkbox.java @@ -3,17 +3,23 @@ package net.silentclient.client.gui.elements; import net.silentclient.client.Client; import net.silentclient.client.gui.clickgui.utils.MouseUtils; import net.silentclient.client.gui.font.SilentFontRenderer; +import net.silentclient.client.gui.theme.checkbox.DefaultCheckboxTheme; +import net.silentclient.client.gui.theme.checkbox.ICheckboxTheme; import net.silentclient.client.gui.util.RenderUtil; import java.awt.*; public class Checkbox { public static void render(int mouseX, int mouseY, int x, int y, String name, boolean selected) { + render(mouseX, mouseY, x, y, name, selected, new DefaultCheckboxTheme()); + } + + public static void render(int mouseX, int mouseY, int x, int y, String name, boolean selected, ICheckboxTheme theme) { boolean hovered = Checkbox.isHovered(mouseX, mouseY, x, y); - Color checkColor = selected ? Color.green : new Color(255, 255, 255); - RenderUtil.drawRoundedOutline(x, y, x + 9, y + 9, 9, 2, new Color(checkColor.getRed(), checkColor.getGreen(), checkColor.getBlue(), hovered ? 127 : 255).getRGB()); + Color checkColor = selected ? theme.getSelectedColor() : theme.getColor(); + RenderUtil.drawRoundedOutline(x, y, 9, 9, 9, 2, new Color(checkColor.getRed(), checkColor.getGreen(), checkColor.getBlue(), hovered ? 127 : 255).getRGB()); if(selected) { - RenderUtil.drawRoundedRect(x + (9 / 2 - 5 / 2), y + (9 / 2 - 5 / 2), x + (9 / 2 - 5 / 2) + 5, y + (9 / 2 - 5 / 2) + 5, 5, checkColor.getRGB()); + RenderUtil.drawRoundedRect(x + (9 / 2 - 5 / 2), y + (9 / 2 - 5 / 2), 5, 5, 5, checkColor.getRGB()); } Client.getInstance().getSilentFontRenderer().drawString(name, x + 12, y + ((9 / 2) - (12 / 2)), 12, SilentFontRenderer.FontType.TITLE); } diff --git a/src/main/java/net/silentclient/client/gui/elements/ColorPicker.java b/src/main/java/net/silentclient/client/gui/elements/ColorPicker.java index 358f2e4..ca35be3 100644 --- a/src/main/java/net/silentclient/client/gui/elements/ColorPicker.java +++ b/src/main/java/net/silentclient/client/gui/elements/ColorPicker.java @@ -10,8 +10,8 @@ import java.awt.*; public class ColorPicker { public static void render(int x, int y, int width, String name, int color) { Client.getInstance().getSilentFontRenderer().drawString(name, x + 100, y - 2, 12, SilentFontRenderer.FontType.TITLE); - RenderUtil.drawRoundedRect(x + width - 20, y + 1, x + width - 20 + 15, y + 9, 5, color); - RenderUtil.drawRoundedOutline(x + width - 20, y + 1, x + width - 20 + 15, y + 9, 5, 2, new Color(255, 255, 255).getRGB()); + RenderUtil.drawRoundedRect(x + width - 20, y + 1, 15, 9, 5, color); + RenderUtil.drawRoundedOutline(x + width - 20, y + 1, 15, 8, 5, 2, new Color(255, 255, 255).getRGB()); } public static boolean isHovered(int mouseX, int mouseY, int x, int y, int width) { diff --git a/src/main/java/net/silentclient/client/gui/elements/IconButton.java b/src/main/java/net/silentclient/client/gui/elements/IconButton.java index 49397b2..2b1b06d 100644 --- a/src/main/java/net/silentclient/client/gui/elements/IconButton.java +++ b/src/main/java/net/silentclient/client/gui/elements/IconButton.java @@ -12,15 +12,13 @@ import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mods.settings.GeneralMod; import net.silentclient.client.utils.TimerUtils; -public class IconButton extends GuiButton +public class IconButton extends Button { - private int animatedOpcaity = 0; private ResourceLocation icon; private int iconWidth; private int iconHeight; - private TimerUtils animateTimer = new TimerUtils(); - + public IconButton(int buttonId, int x, int y, int widthIn, int heightIn, int iconWidth, int iconHeight, ResourceLocation icon) { super(buttonId, x, y, widthIn, heightIn, ""); this.icon = icon; @@ -33,41 +31,8 @@ public class IconButton extends GuiButton this(buttonId, x, y, 20, 20, 12, 12, icon); } - public void drawButton(Minecraft mc, int mouseX, int mouseY) - { - if (this.visible) - { - GlStateManager.disableBlend(); - this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; - RenderUtil.drawRoundedRect((float) xPosition, (float)yPosition, (float)xPosition + width, (float)yPosition + height, (float)5, new Color(255,255,255,animatedOpcaity).getRGB()); - RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, new Color(255,255,255,255).getRGB()); - this.mouseDragged(mc, mouseX, mouseY); - if (!this.enabled) - { - } - - if (this.hovered && this.enabled) { - if (this.animatedOpcaity < 75 && animateTimer.delay(30)) { - this.animatedOpcaity += 15; - animateTimer.reset(); - } - } else { - if (this.animatedOpcaity != 0 && animateTimer.delay(30)) { - this.animatedOpcaity -= 15; - animateTimer.reset(); - } - } - - RenderUtil.drawImage(icon, this.xPosition + ((this.width / 2) - (this.iconWidth / 2)), this.yPosition + ((this.height / 2) - (this.iconHeight / 2)), this.iconWidth, this.iconHeight, false); - } - } - @Override - public void playPressSound(SoundHandler soundHandlerIn) { - if(!Client.getInstance().getSettingsManager().getSettingByClass(GeneralMod.class, "Silent Button Sounds").getValBoolean()) { - return; - } - super.playPressSound(soundHandlerIn); + protected void drawButtonContent() { + RenderUtil.drawImage(icon, this.xPosition + ((this.width / 2) - (this.iconWidth / 2)), this.yPosition + ((this.height / 2) - (this.iconHeight / 2)), this.iconWidth, this.iconHeight, false); } - } diff --git a/src/main/java/net/silentclient/client/gui/elements/Input.java b/src/main/java/net/silentclient/client/gui/elements/Input.java index f76e86b..43f7151 100644 --- a/src/main/java/net/silentclient/client/gui/elements/Input.java +++ b/src/main/java/net/silentclient/client/gui/elements/Input.java @@ -6,6 +6,8 @@ import net.minecraft.util.EnumChatFormatting; import net.silentclient.client.Client; import net.silentclient.client.gui.clickgui.utils.MouseUtils; import net.silentclient.client.gui.font.SilentFontRenderer; +import net.silentclient.client.gui.theme.input.DefaultInputTheme; +import net.silentclient.client.gui.theme.input.IInputTheme; import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.utils.ColorUtils; import net.silentclient.client.utils.NotificationUtils; @@ -61,33 +63,37 @@ public class Input { } public void render(int mouseX, int mouseY, int x, int y, int width, boolean small) { - int borderColor = new Color(255, 255, 255, 41).getRGB(); + this.render(mouseX, mouseY, x, y, width, small, new DefaultInputTheme()); + } + + public void render(int mouseX, int mouseY, int x, int y, int width, boolean small, IInputTheme theme) { + int borderColor = theme.getBorderColor().getRGB(); if(MouseUtils.isInside(mouseX, mouseY, x, y, width, 20)) { - borderColor = new Color(255, 255, 255, 61).getRGB(); + borderColor = theme.getHoveredBorderColor().getRGB(); this.hovered = true; } else { this.hovered = false; } if(isFocused) { - borderColor = new Color(255, 255, 255, 255).getRGB(); + borderColor = theme.getFocusedBorderColor().getRGB(); } - RenderUtil.drawRoundedOutline(x, y, x + width, y + (small ? 15 : 20), 5, 3, borderColor); + RenderUtil.drawRoundedOutline(x, y, width, (small ? 15 : 20), 3, isFocused ? 2 : 1, borderColor); String renderText = name; - ColorUtils.setColor(new Color(255, 255, 255, 41).getRGB()); + ColorUtils.setColor(theme.getBorderColor().getRGB()); if(value.length() != 0) { renderText = value; - ColorUtils.setColor(new Color(255, 255, 255, 255).getRGB()); + ColorUtils.setColor(theme.getFocusedBorderColor().getRGB()); } if(keyValue) { if(key != -1) { renderText = Keyboard.getKeyName(key); - ColorUtils.setColor(new Color(255, 255, 255, 255).getRGB()); + ColorUtils.setColor(theme.getFocusedBorderColor().getRGB()); } if(isFocused) { renderText = "..."; - ColorUtils.setColor(new Color(255, 255, 255, 255).getRGB()); + ColorUtils.setColor(theme.getFocusedBorderColor().getRGB()); } } Client.getInstance().getSilentFontRenderer().drawString(EnumChatFormatting.getTextWithoutFormattingCodes(renderText), x + 2, y + (small ? 1 : 3), small ? 12 : 14, SilentFontRenderer.FontType.TITLE); diff --git a/src/main/java/net/silentclient/client/gui/elements/StaticButton.java b/src/main/java/net/silentclient/client/gui/elements/StaticButton.java index 1104dbe..6350e64 100644 --- a/src/main/java/net/silentclient/client/gui/elements/StaticButton.java +++ b/src/main/java/net/silentclient/client/gui/elements/StaticButton.java @@ -1,12 +1,12 @@ package net.silentclient.client.gui.elements; -import java.awt.Color; - import net.minecraft.client.renderer.GlStateManager; import net.silentclient.client.Client; import net.silentclient.client.gui.clickgui.utils.MouseUtils; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.util.RenderUtil; +import net.silentclient.client.gui.theme.button.DefaultButtonTheme; +import net.silentclient.client.gui.theme.button.IButtonTheme; import net.silentclient.client.utils.ColorUtils; public class StaticButton { @@ -14,13 +14,21 @@ public class StaticButton { { StaticButton.render(xPosition, yPosition, width, height, displayString, false); } + + public static void render(int xPosition, int yPosition, int width, int height, String displayString, boolean bold) + { + StaticButton.render(xPosition, yPosition, width, height, displayString, bold, new DefaultButtonTheme()); + } - public static void render(int xPosition, int yPosition, int width, int height, String displayString, boolean bold) + public static void render(int xPosition, int yPosition, int width, int height, String displayString, boolean bold, IButtonTheme theme) { GlStateManager.disableBlend(); - ColorUtils.setColor(new Color(255,255,255,255).getRGB()); - RenderUtil.drawRoundedOutline(xPosition, yPosition, xPosition + width, yPosition + height, 5, 2, new Color(255,255,255,255).getRGB()); - + ColorUtils.setColor(theme.getBackgroundColor().getRGB()); + RenderUtil.drawRoundedRect(xPosition, yPosition, width, height, 3, theme.getBackgroundColor().getRGB()); + ColorUtils.setColor(theme.getBorderColor().getRGB()); + RenderUtil.drawRoundedOutline(xPosition, yPosition, width, height, 3, 1, theme.getBorderColor().getRGB()); + + ColorUtils.setColor(theme.getTextColor().getRGB()); Client.getInstance().getSilentFontRenderer().drawCenteredString(displayString, xPosition + width / 2, yPosition + (height - (bold ? 8 : 10)) / 2, bold ? 8 : 10, bold ? SilentFontRenderer.FontType.HEADER : SilentFontRenderer.FontType.TITLE, width - (bold ? 8 : 10)); } diff --git a/src/main/java/net/silentclient/client/gui/elements/Switch.java b/src/main/java/net/silentclient/client/gui/elements/Switch.java index aa40b78..fc82a84 100644 --- a/src/main/java/net/silentclient/client/gui/elements/Switch.java +++ b/src/main/java/net/silentclient/client/gui/elements/Switch.java @@ -1,16 +1,22 @@ package net.silentclient.client.gui.elements; -import java.awt.Color; - import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.clickgui.utils.MouseUtils; -import net.silentclient.client.gui.util.RoundedUtils; +import net.silentclient.client.gui.theme.switches.DefaultSwitchTheme; +import net.silentclient.client.gui.theme.switches.ISwitchSchema; +import net.silentclient.client.gui.util.RenderUtil; public class Switch { public static void render(int mouseX, int mouseY, float x, float y, SimpleAnimation animation, boolean checked, boolean disabled) { - RoundedUtils.drawRoundedRect(x, y, x + 15, y + 8, 8, disabled ? new Color(229, 62, 62).getRGB() : checked ? Color.GREEN.getRGB() : new Color(255, 255, 255, 61).getRGB()); - RoundedUtils.drawRoundedOutline(x, y, x + 15, y + 8, 8, 2, new Color(255, 255, 255, isHovered(mouseX, mouseY, x, y) ? 127 : 0).getRGB()); - RoundedUtils.drawRoundedRect(x + 0.5F + (animation.getValue()), y + 0.5F, x + 0.5F + (animation.getValue()) + 7, y + 0.5F + 7, 7, -1); + render(mouseX, mouseY, x, y, animation, checked, disabled, new DefaultSwitchTheme()); + } + + public static void render(int mouseX, int mouseY, float x, float y, SimpleAnimation animation, boolean checked, boolean disabled, ISwitchSchema theme) { + RenderUtil.drawRoundedRect(x, y, 15, 8, 8, disabled ? theme.getDisabledBackgroundColor().getRGB() : checked ? theme.getSelectedBackgroundColor().getRGB() : theme.getBackgroundColor().getRGB()); + if(isHovered(mouseX, mouseY, x, y)) { + RenderUtil.drawRoundedOutline(x, y, 15, 8, 8, 2, theme.getBorderColor().getRGB()); + } + RenderUtil.drawRoundedRect(x + 0.5F + (animation.getValue()), y + 0.5F, 7, 7, 7, theme.getCircleColor().getRGB()); animation.setAnimation(checked && !disabled ? 15 - 8 : 0, 20); } diff --git a/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java b/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java index 5251d90..c0a1192 100644 --- a/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java +++ b/src/main/java/net/silentclient/client/gui/friends/FriendsListOverlay.java @@ -1,13 +1,5 @@ package net.silentclient.client.gui.friends; -import java.awt.Color; -import java.io.IOException; - -import net.silentclient.client.utils.MenuBlurUtils; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; - -import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; @@ -15,17 +7,25 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; import net.silentclient.client.gui.animation.SimpleAnimation; -import net.silentclient.client.gui.clickgui.TabButton; import net.silentclient.client.gui.clickgui.utils.MouseUtils; import net.silentclient.client.gui.clickgui.utils.RenderUtils; +import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.IconButton; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.notification.NotificationManager; import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mods.settings.GeneralMod; +import net.silentclient.client.gui.theme.button.DefaultButtonTheme; +import net.silentclient.client.gui.theme.button.SelectedButtonTheme; import net.silentclient.client.utils.ColorUtils; +import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.types.FriendsResponse; +import org.lwjgl.input.Mouse; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.io.IOException; public class FriendsListOverlay extends GuiScreen { private double scrollY; @@ -42,8 +42,8 @@ public class FriendsListOverlay extends GuiScreen { MenuBlurUtils.loadBlur(); this.buttonList.add(new IconButton(1, 133, 6, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png"))); - this.buttonList.add(new TabButton(2, 3, 26, 70, 15, "Friends", 12, !showRequests)); - this.buttonList.add(new TabButton(3, 76, 26, 70, 15, "Requests", 12, showRequests)); + this.buttonList.add(new Button(2, 3, 26, 70, 15, "Friends", 12, false, !showRequests ? new SelectedButtonTheme() : new DefaultButtonTheme())); + this.buttonList.add(new Button(3, 76, 26, 70, 15, "Requests", 12, false, showRequests ? new SelectedButtonTheme() : new DefaultButtonTheme())); this.buttonList.add(new IconButton(4, 116, 6, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/friends-add.png"))); } @@ -132,21 +132,25 @@ public class FriendsListOverlay extends GuiScreen { @Override protected void actionPerformed(GuiButton button) throws IOException { super.actionPerformed(button); - if(button instanceof TabButton) { - TabButton tab = (TabButton) button; - if(tab.id == 2) { + if(button instanceof Button) { + if(button.id == 2) { + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); showRequests = false; } else { + this.buttonList.forEach(oldButton -> { + if(oldButton instanceof Button) { + ((Button) oldButton).setTheme(new DefaultButtonTheme()); + } + }); + ((Button) button).setTheme(new SelectedButtonTheme()); showRequests = true; } scrollY = 0; - this.buttonList.forEach(oldButton -> { - if(oldButton instanceof TabButton) { - TabButton tabB = (TabButton) oldButton; - tabB.selected = false; - } - }); - tab.selected = true; } switch (button.id) { case 1: diff --git a/src/main/java/net/silentclient/client/gui/notification/Notification.java b/src/main/java/net/silentclient/client/gui/notification/Notification.java index c0f0d76..bc40772 100644 --- a/src/main/java/net/silentclient/client/gui/notification/Notification.java +++ b/src/main/java/net/silentclient/client/gui/notification/Notification.java @@ -62,7 +62,7 @@ public class Notification { animation.setDirection(Direction.BACKWARDS); } - RenderUtil.drawRoundedRect((float) (sr.getScaledWidth() - offset), 4, ((float) (sr.getScaledWidth() - offset)) + (this.width - 5), 4 + 26, 3, new Color(19, 19, 19).getRGB()); + RenderUtil.drawRoundedRect((float) (sr.getScaledWidth() - offset), 4, (this.width - 5), 26, 3, new Color(19, 19, 19).getRGB()); RenderUtil.drawImage(new ResourceLocation("silentclient/mods/notifications/"+ status.toLowerCase() + ".png"), (float) (sr.getScaledWidth() - offset) + 2, 4 + 2, 22, 22); font.drawString(WordUtils.capitalize(status), (int) (sr.getScaledWidth() - offset + 28), 4 + 3, -1, false); diff --git a/src/main/java/net/silentclient/client/gui/theme/Theme.java b/src/main/java/net/silentclient/client/gui/theme/Theme.java index 830cb4d..61b5fc7 100644 --- a/src/main/java/net/silentclient/client/gui/theme/Theme.java +++ b/src/main/java/net/silentclient/client/gui/theme/Theme.java @@ -6,4 +6,8 @@ public class Theme { public static Color backgroundColor() { return new Color(0, 0, 0, 127); } + + public static Color borderColor() { + return new Color(214, 213, 210); + } } diff --git a/src/main/java/net/silentclient/client/gui/theme/button/DefaultButtonTheme.java b/src/main/java/net/silentclient/client/gui/theme/button/DefaultButtonTheme.java new file mode 100644 index 0000000..eaa5095 --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/theme/button/DefaultButtonTheme.java @@ -0,0 +1,26 @@ +package net.silentclient.client.gui.theme.button; + +import java.awt.*; + +public class DefaultButtonTheme implements IButtonTheme { + + @Override + public Color getBorderColor() { + return new Color(214, 213, 210); + } + + @Override + public Color getBackgroundColor() { + return new Color(0, 0, 0, 40); + } + + @Override + public Color getTextColor() { + return new Color(255, 255, 255); + } + + @Override + public Color getHoveredBackgroundColor(int opacity) { + return new Color(255, 255, 255, opacity); + } +} diff --git a/src/main/java/net/silentclient/client/gui/theme/button/IButtonTheme.java b/src/main/java/net/silentclient/client/gui/theme/button/IButtonTheme.java new file mode 100644 index 0000000..4fa270f --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/theme/button/IButtonTheme.java @@ -0,0 +1,10 @@ +package net.silentclient.client.gui.theme.button; + +import java.awt.*; + +public interface IButtonTheme { + Color getBorderColor(); + Color getBackgroundColor(); + Color getTextColor(); + Color getHoveredBackgroundColor(int opacity); +} diff --git a/src/main/java/net/silentclient/client/gui/theme/button/SelectedButtonTheme.java b/src/main/java/net/silentclient/client/gui/theme/button/SelectedButtonTheme.java new file mode 100644 index 0000000..350466b --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/theme/button/SelectedButtonTheme.java @@ -0,0 +1,25 @@ +package net.silentclient.client.gui.theme.button; + +import java.awt.*; + +public class SelectedButtonTheme implements IButtonTheme { + @Override + public Color getBorderColor() { + return new Color(255, 255, 255); + } + + @Override + public Color getBackgroundColor() { + return new Color(255, 255, 255); + } + + @Override + public Color getTextColor() { + return new Color(0, 0, 0); + } + + @Override + public Color getHoveredBackgroundColor(int opacity) { + return new Color(255, 255, 255, opacity); + } +} diff --git a/src/main/java/net/silentclient/client/gui/theme/buttonthemes/IButtonSchema.java b/src/main/java/net/silentclient/client/gui/theme/buttonthemes/IButtonSchema.java deleted file mode 100644 index 918a08c..0000000 --- a/src/main/java/net/silentclient/client/gui/theme/buttonthemes/IButtonSchema.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.silentclient.client.gui.theme.buttonthemes; - -import java.awt.*; - -public interface IButtonSchema { - Color getBackgroundColor(); -} diff --git a/src/main/java/net/silentclient/client/gui/theme/checkbox/DefaultCheckboxTheme.java b/src/main/java/net/silentclient/client/gui/theme/checkbox/DefaultCheckboxTheme.java new file mode 100644 index 0000000..66ca039 --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/theme/checkbox/DefaultCheckboxTheme.java @@ -0,0 +1,15 @@ +package net.silentclient.client.gui.theme.checkbox; + +import java.awt.*; + +public class DefaultCheckboxTheme implements ICheckboxTheme { + @Override + public Color getColor() { + return new Color(214, 213, 210); + } + + @Override + public Color getSelectedColor() { + return new Color(165, 227, 177); + } +} diff --git a/src/main/java/net/silentclient/client/gui/theme/checkbox/ICheckboxTheme.java b/src/main/java/net/silentclient/client/gui/theme/checkbox/ICheckboxTheme.java new file mode 100644 index 0000000..3599a25 --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/theme/checkbox/ICheckboxTheme.java @@ -0,0 +1,8 @@ +package net.silentclient.client.gui.theme.checkbox; + +import java.awt.*; + +public interface ICheckboxTheme { + Color getColor(); + Color getSelectedColor(); +} diff --git a/src/main/java/net/silentclient/client/gui/theme/input/DefaultInputTheme.java b/src/main/java/net/silentclient/client/gui/theme/input/DefaultInputTheme.java new file mode 100644 index 0000000..4e6694e --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/theme/input/DefaultInputTheme.java @@ -0,0 +1,20 @@ +package net.silentclient.client.gui.theme.input; + +import java.awt.*; + +public class DefaultInputTheme implements IInputTheme { + @Override + public Color getBorderColor() { + return new Color(214, 213, 210); + } + + @Override + public Color getHoveredBorderColor() { + return new Color(230, 230, 230); + } + + @Override + public Color getFocusedBorderColor() { + return new Color(255, 255, 255); + } +} diff --git a/src/main/java/net/silentclient/client/gui/theme/input/IInputTheme.java b/src/main/java/net/silentclient/client/gui/theme/input/IInputTheme.java new file mode 100644 index 0000000..7309f14 --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/theme/input/IInputTheme.java @@ -0,0 +1,9 @@ +package net.silentclient.client.gui.theme.input; + +import java.awt.*; + +public interface IInputTheme { + Color getBorderColor(); + Color getHoveredBorderColor(); + Color getFocusedBorderColor(); +} diff --git a/src/main/java/net/silentclient/client/gui/theme/switches/DefaultSwitchTheme.java b/src/main/java/net/silentclient/client/gui/theme/switches/DefaultSwitchTheme.java new file mode 100644 index 0000000..b1aa76e --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/theme/switches/DefaultSwitchTheme.java @@ -0,0 +1,30 @@ +package net.silentclient.client.gui.theme.switches; + +import java.awt.*; + +public class DefaultSwitchTheme implements ISwitchSchema { + @Override + public Color getSelectedBackgroundColor() { + return new Color(165, 227, 177); + } + + @Override + public Color getDisabledBackgroundColor() { + return new Color(229, 62, 62); + } + + @Override + public Color getBackgroundColor() { + return new Color(255, 255, 255, 61); + } + + @Override + public Color getCircleColor() { + return new Color(255, 255, 255); + } + + @Override + public Color getBorderColor() { + return new Color(214, 213, 210); + } +} diff --git a/src/main/java/net/silentclient/client/gui/theme/switches/ISwitchSchema.java b/src/main/java/net/silentclient/client/gui/theme/switches/ISwitchSchema.java new file mode 100644 index 0000000..da0a73f --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/theme/switches/ISwitchSchema.java @@ -0,0 +1,11 @@ +package net.silentclient.client.gui.theme.switches; + +import java.awt.*; + +public interface ISwitchSchema { + Color getSelectedBackgroundColor(); + Color getDisabledBackgroundColor(); + Color getBackgroundColor(); + Color getCircleColor(); + Color getBorderColor(); +} diff --git a/src/main/java/net/silentclient/client/gui/util/RenderUtil.java b/src/main/java/net/silentclient/client/gui/util/RenderUtil.java index eb7c60a..092847e 100644 --- a/src/main/java/net/silentclient/client/gui/util/RenderUtil.java +++ b/src/main/java/net/silentclient/client/gui/util/RenderUtil.java @@ -22,151 +22,9 @@ public class RenderUtil { final static Minecraft mc = Minecraft.getMinecraft(); final static FontRenderer fr = mc.fontRendererObj; - - public static void drawFilledWithGL(AxisAlignedBB box) { - final Tessellator tessellator = Tessellator.getInstance(); - final WorldRenderer worldRenderer = tessellator.getWorldRenderer(); - worldRenderer.begin(7, DefaultVertexFormats.POSITION); - worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); - worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); - tessellator.draw(); - worldRenderer.begin(7, DefaultVertexFormats.POSITION); - worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); - worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); - tessellator.draw(); - worldRenderer.begin(7, DefaultVertexFormats.POSITION); - worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); - worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); - tessellator.draw(); - worldRenderer.begin(7, DefaultVertexFormats.POSITION); - worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); - worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); - worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); - tessellator.draw(); - worldRenderer.begin(7, DefaultVertexFormats.POSITION); - worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); - worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); - worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); - tessellator.draw(); - worldRenderer.begin(7, DefaultVertexFormats.POSITION); - worldRenderer.pos(box.minX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.minX, box.minY, box.maxZ).endVertex(); - worldRenderer.pos(box.minX, box.maxY, box.minZ).endVertex(); - worldRenderer.pos(box.minX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.minZ).endVertex(); - worldRenderer.pos(box.maxX, box.maxY, box.maxZ).endVertex(); - worldRenderer.pos(box.maxX, box.minY, box.maxZ).endVertex(); - tessellator.draw(); - } - - - public static void enableGL2D() { - glDisable(GL_DEPTH_TEST); - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDepthMask(true); - glEnable(GL_LINE_SMOOTH); - glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); - } - - public static void disableGL2D() { - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glEnable(GL_DEPTH_TEST); - glDisable(GL_LINE_SMOOTH); - glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE); - glHint(GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE); - } - /* - * - * NORMAL - * - */ - - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param radius : round of edges; - * @param color : color; - */ - - public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) { - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glEnable(GL_LINE_SMOOTH); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glBegin(GL_POLYGON); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); - 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); - glEnd(); - glBegin(GL_LINE_LOOP); - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); - 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); - glEnd(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_LINE_SMOOTH); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - glLineWidth(1); - 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) { + x1 = x + x1; + y1 = y + y1; glPushAttrib(0); glScaled(0.5D, 0.5D, 0.5D); x *= 2.0D; @@ -181,35 +39,37 @@ public class RenderUtil { glBegin(GL_POLYGON); int i; for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); + glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); 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(); + glBegin(GL_LINE_LOOP); + for (i = 0; i <= 90; i += 3) + glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 90; i <= 180; i += 3) + glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); + for (i = 0; i <= 90; i += 3) + glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); + 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); glEnd(); glEnable(GL_TEXTURE_2D); glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); + glEnable(GL_TEXTURE_2D); glScaled(2.0D, 2.0D, 2.0D); - glEnable(GL_BLEND); glPopAttrib(); + glLineWidth(1); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param radius : round of edges; - * @param lineWidth : width of outline line; - * @param color : color; - */ - public static void drawRoundedOutline(float x, float y, float x1, float y1, float radius,float lineWidth, int color) { + x1 = x + x1; + y1 = y + y1; glPushAttrib(0); glScaled(0.5D, 0.5D, 0.5D); x *= 2.0D; @@ -242,104 +102,13 @@ public class RenderUtil { glLineWidth(1); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); } - - /* - * - * SELECTED EDGES - * - */ - - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param radius1 : round of left top edges; - * @param radius2 : round of right top edges; - * @param radius3 : round of left bottom edges; - * @param radius4 : round of right bottom edges; - * @param color : color; - */ - - public static void drawSelectRoundedRect(float x, float y, float x1, float y1, float radius1,float radius2,float radius3,float radius4, int color) { - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glBegin(9); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius1 + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, y + radius1 + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius2 + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, y1 - radius2 + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius3 + Math.sin(i * Math.PI / 180.0D) * radius3, y1 - radius3 + Math.cos(i * Math.PI / 180.0D) * radius3); - for (i = 90; i <= 180; i += 3) - glVertex2d(x1 - radius4 + Math.sin(i * Math.PI / 180.0D) * radius4, y + radius4 + Math.cos(i * Math.PI / 180.0D) * radius4); - glEnd(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - glLineWidth(1); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - } - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param radius1 : round of left top edges; - * @param radius2 : round of right top edges; - * @param radius3 : round of left bottom edges; - * @param radius4 : round of right bottom edges; - * @param lineWidth : width of outline line; - * @param color : color; + /* + * + * SELECTED EDGES + * */ - - public static void drawSelectRoundedOutline(float x, float y, float x1, float y1, float radius1,float radius2,float radius3,float radius4,float lineWidth, int color) { - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glLineWidth(lineWidth); - glBegin(GL_LINE_LOOP); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius1 + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, y + radius1 + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius2 + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, y1 - radius2 + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius3 + Math.sin(i * Math.PI / 180.0D) * radius3, y1 - radius3 + Math.cos(i * Math.PI / 180.0D) * radius3); - for (i = 90; i <= 180; i += 3) - glVertex2d(x1 - radius4 + Math.sin(i * Math.PI / 180.0D) * radius4, y + radius4 + Math.cos(i * Math.PI / 180.0D) * radius4); - glEnd(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - glLineWidth(1); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - } + public static void setColor(int color) { float a = (color >> 24 & 0xFF) / 255.0F; float r = (color >> 16 & 0xFF) / 255.0F; @@ -347,136 +116,6 @@ public class RenderUtil { float b = (color & 0xFF) / 255.0F; GlStateManager.color(r, g, b, a); } - - /* - * - * GRADIENT - * - */ - - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param radius : round of edges; - * @param color : color; - * @param color2 : color2; - * @param color3 : color3; - * @param color4 : color4; - */ - public static void drawRoundedGradientRectCorner(float x, float y, float x1, float y1, float radius, int color, int color2, int color3, int color4) { - setColor(-1); - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_LINE_SMOOTH); - glShadeModel(GL_SMOOTH); - - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glShadeModel(GL_SMOOTH); - glBegin(9); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - setColor(color2); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - setColor(color3); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); - setColor(color4); - 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); - glEnd(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - - - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glShadeModel(GL_FLAT); - setColor(-1); - } - - - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param width : width of line; - * @param radius : round of edges; - * @param color : color; - * @param color2 : color2; - * @param color3 : color3; - * @param color4 : color4; - */ - public static void drawRoundedGradientOutlineCorner(float x, float y, float x1, float y1, float width, float radius, int color, int color2, int color3, int color4) { - setColor(-1); - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_LINE_SMOOTH); - glShadeModel(GL_SMOOTH); - - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glShadeModel(GL_SMOOTH); - glLineWidth(width); - glBegin(GL_LINE_LOOP); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - setColor(color2); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - setColor(color3); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); - setColor(color4); - 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); - glEnd(); - glLineWidth(1); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - - - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glShadeModel(GL_FLAT); - setColor(-1); - } public static void drawImage(float x, float y, float width, float height) { GL11.glPushMatrix(); diff --git a/src/main/java/net/silentclient/client/gui/util/RoundedUtils.java b/src/main/java/net/silentclient/client/gui/util/RoundedUtils.java deleted file mode 100644 index c60d6dd..0000000 --- a/src/main/java/net/silentclient/client/gui/util/RoundedUtils.java +++ /dev/null @@ -1,402 +0,0 @@ -package net.silentclient.client.gui.util; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import static org.lwjgl.opengl.GL11.*; - - -public class RoundedUtils { - - final static Minecraft mc = Minecraft.getMinecraft(); - final static FontRenderer fr = mc.fontRendererObj; - - public static void enableGL2D() { - glDisable(GL_DEPTH_TEST); - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDepthMask(true); - glEnable(GL_LINE_SMOOTH); - glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); - glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); - } - - public static void disableGL2D() { - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glEnable(GL_DEPTH_TEST); - glDisable(GL_LINE_SMOOTH); - glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE); - glHint(GL_POLYGON_SMOOTH_HINT, GL_DONT_CARE); - } - /* - * - * NORMAL - * - */ - - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param radius : round of edges; - * @param color : color; - */ - - public static void drawSmoothRoundedRect(float x, float y, float x1, float y1, float radius, int color) { - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glEnable(GL_LINE_SMOOTH); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glBegin(GL_POLYGON); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); - 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); - glEnd(); - glBegin(GL_LINE_LOOP); - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); - 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); - glEnd(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_LINE_SMOOTH); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - glLineWidth(1); - 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) { - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glEnable(GL_LINE_SMOOTH); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glBegin(GL_POLYGON); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); - 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); - glEnd(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glScaled(2.0D, 2.0D, 2.0D); - glEnable(GL_BLEND); - glPopAttrib(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - } - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param radius : round of edges; - * @param lineWidth : width of outline line; - * @param color : color; - */ - - public static void drawRoundedOutline(float x, float y, float x1, float y1, float radius,float lineWidth, int color) { - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glLineWidth(lineWidth); - glBegin(GL_LINE_LOOP); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); - 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); - glEnd(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - glLineWidth(1); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - } - - /* - * - * SELECTED EDGES - * - */ - - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param radius1 : round of left top edges; - * @param radius2 : round of right top edges; - * @param radius3 : round of left bottom edges; - * @param radius4 : round of right bottom edges; - * @param color : color; - */ - - public static void drawSelectRoundedRect(float x, float y, float x1, float y1, float radius1,float radius2,float radius3,float radius4, int color) { - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glBegin(9); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius1 + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, y + radius1 + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius2 + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, y1 - radius2 + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius3 + Math.sin(i * Math.PI / 180.0D) * radius3, y1 - radius3 + Math.cos(i * Math.PI / 180.0D) * radius3); - for (i = 90; i <= 180; i += 3) - glVertex2d(x1 - radius4 + Math.sin(i * Math.PI / 180.0D) * radius4, y + radius4 + Math.cos(i * Math.PI / 180.0D) * radius4); - glEnd(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - glLineWidth(1); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - } - - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param radius1 : round of left top edges; - * @param radius2 : round of right top edges; - * @param radius3 : round of left bottom edges; - * @param radius4 : round of right bottom edges; - * @param lineWidth : width of outline line; - * @param color : color; - */ - - public static void drawSelectRoundedOutline(float x, float y, float x1, float y1, float radius1,float radius2,float radius3,float radius4,float lineWidth, int color) { - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glLineWidth(lineWidth); - glBegin(GL_LINE_LOOP); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius1 + Math.sin(i * Math.PI / 180.0D) * radius1 * -1.0D, y + radius1 + Math.cos(i * Math.PI / 180.0D) * radius1 * -1.0D); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius2 + Math.sin(i * Math.PI / 180.0D) * radius2 * -1.0D, y1 - radius2 + Math.cos(i * Math.PI / 180.0D) * radius2 * -1.0D); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius3 + Math.sin(i * Math.PI / 180.0D) * radius3, y1 - radius3 + Math.cos(i * Math.PI / 180.0D) * radius3); - for (i = 90; i <= 180; i += 3) - glVertex2d(x1 - radius4 + Math.sin(i * Math.PI / 180.0D) * radius4, y + radius4 + Math.cos(i * Math.PI / 180.0D) * radius4); - glEnd(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - glLineWidth(1); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - } - public static void setColor(int color) { - float a = (color >> 24 & 0xFF) / 255.0F; - float r = (color >> 16 & 0xFF) / 255.0F; - float g = (color >> 8 & 0xFF) / 255.0F; - float b = (color & 0xFF) / 255.0F; - glColor4f(r, g, b, a); - } - - /* - * - * GRADIENT - * - */ - - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param radius : round of edges; - * @param color : color; - * @param color2 : color2; - * @param color3 : color3; - * @param color4 : color4; - */ - public static void drawRoundedGradientRectCorner(float x, float y, float x1, float y1, float radius, int color, int color2, int color3, int color4) { - setColor(-1); - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_LINE_SMOOTH); - glShadeModel(GL_SMOOTH); - - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glShadeModel(GL_SMOOTH); - glBegin(9); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - setColor(color2); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - setColor(color3); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); - setColor(color4); - 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); - glEnd(); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - - - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glShadeModel(GL_FLAT); - setColor(-1); - } - - - /** - * @param x : X pos - * @param y : Y pos - * @param x1 : X2 pos - * @param y1 : Y2 pos - * @param width : width of line; - * @param radius : round of edges; - * @param color : color; - * @param color2 : color2; - * @param color3 : color3; - * @param color4 : color4; - */ - public static void drawRoundedGradientOutlineCorner(float x, float y, float x1, float y1, float width, float radius, int color, int color2, int color3, int color4) { - setColor(-1); - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_LINE_SMOOTH); - glShadeModel(GL_SMOOTH); - - glPushAttrib(0); - glScaled(0.5D, 0.5D, 0.5D); - x *= 2.0D; - y *= 2.0D; - x1 *= 2.0D; - y1 *= 2.0D; - glEnable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - setColor(color); - glEnable(GL_LINE_SMOOTH); - glShadeModel(GL_SMOOTH); - glLineWidth(width); - glBegin(GL_LINE_LOOP); - int i; - for (i = 0; i <= 90; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y + radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - setColor(color2); - for (i = 90; i <= 180; i += 3) - glVertex2d(x + radius + Math.sin(i * Math.PI / 180.0D) * radius * -1.0D, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius * -1.0D); - setColor(color3); - for (i = 0; i <= 90; i += 3) - glVertex2d(x1 - radius + Math.sin(i * Math.PI / 180.0D) * radius, y1 - radius + Math.cos(i * Math.PI / 180.0D) * radius); - setColor(color4); - 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); - glEnd(); - glLineWidth(1); - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_BLEND); - glEnable(GL_TEXTURE_2D); - glScaled(2.0D, 2.0D, 2.0D); - glPopAttrib(); - - - glEnable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - glDisable(GL_LINE_SMOOTH); - glShadeModel(GL_FLAT); - setColor(-1); - } -} diff --git a/src/main/java/net/silentclient/client/mods/ModDraggable.java b/src/main/java/net/silentclient/client/mods/ModDraggable.java index 58d71a3..422ae33 100644 --- a/src/main/java/net/silentclient/client/mods/ModDraggable.java +++ b/src/main/java/net/silentclient/client/mods/ModDraggable.java @@ -162,8 +162,6 @@ public abstract class ModDraggable extends Mod implements IRenderer { Client.getInstance().getSilentFontRenderer().drawString(debugX, debugY + 30, "dragging: " + this.isDragging(), 6, SilentFontRenderer.FontType.TITLE); ColorUtils.setColor(-1); Client.getInstance().getSilentFontRenderer().drawString(debugX, debugY + 36, "cursor: " + Client.getInstance().getMouseCursorHandler().getCurrentCursor(), 6, SilentFontRenderer.FontType.TITLE); - ColorUtils.setColor(-1); - Client.getInstance().getSilentFontRenderer().drawString(debugX, debugY + 42, "corner: " + (pos.getAbsoluteX() + (getCornerX(HUDConfigScreen.CornerScalingType.BOTTOM_RIGHT) * getScale())) + ", " + (pos.getAbsoluteY() + (getCornerY(HUDConfigScreen.CornerScalingType.BOTTOM_RIGHT) * getScale())), 6, SilentFontRenderer.FontType.TITLE); GlStateManager.popMatrix(); } ColorUtils.setColor(-1); @@ -185,7 +183,7 @@ public abstract class ModDraggable extends Mod implements IRenderer { color = new Color(245, 188, 0).getRGB(); } - RenderUtil.drawRoundedRect(getCornerX(cornerType), getCornerY(cornerType), getCornerX(cornerType) + 3, getCornerY(cornerType) + 3, 3, color); + RenderUtil.drawRoundedRect(getCornerX(cornerType), getCornerY(cornerType), 3, 3, 3, color); } public int getCornerX(HUDConfigScreen.CornerScalingType cornerType) { diff --git a/src/main/java/net/silentclient/client/mods/hud/MouseStrokesMod.java b/src/main/java/net/silentclient/client/mods/hud/MouseStrokesMod.java index 703a984..13f8c18 100644 --- a/src/main/java/net/silentclient/client/mods/hud/MouseStrokesMod.java +++ b/src/main/java/net/silentclient/client/mods/hud/MouseStrokesMod.java @@ -88,7 +88,7 @@ public class MouseStrokesMod extends ModDraggable { pitchAnimation.setAnimation(lastY, 100); ColorUtils.setColor(dotColor.getRGB()); - RenderUtil.drawRoundedRect(0 + 23 + yawAnimation.getValue() + 8, 0 + 23 + pitchAnimation.getValue() + 8, 0 + 23 + yawAnimation.getValue() + 4 + 8, 0 + 23 + pitchAnimation.getValue() + 4 + 8, 4, dotColor.getRGB()); + RenderUtil.drawRoundedRect(0 + 23 + yawAnimation.getValue() + 8, 0 + 23 + pitchAnimation.getValue() + 8, 4, 4, 4, dotColor.getRGB()); ColorUtils.setColor(-1); GlStateManager.popMatrix(); return true; diff --git a/src/main/java/net/silentclient/client/mods/render/CrosshairMod.java b/src/main/java/net/silentclient/client/mods/render/CrosshairMod.java index dc25d70..ab34969 100644 --- a/src/main/java/net/silentclient/client/mods/render/CrosshairMod.java +++ b/src/main/java/net/silentclient/client/mods/render/CrosshairMod.java @@ -163,8 +163,8 @@ public class CrosshairMod extends Mod { int spacing = 0; int crossY = y + 30; String selected = Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Preset ID").getValString(); - RenderUtil.drawRoundedRect(x + spacing, crossY - 1, x + spacing + 22, crossY - 1 + 22, 5, new Color(0, 0, 0).getRGB()); - RenderUtil.drawRoundedOutline(x + spacing, crossY - 1, x + spacing + 22, crossY - 1 + 22, 5, 3, -1); + RenderUtil.drawRoundedRect(x + spacing, crossY - 1, 22, 22, 5, new Color(0, 0, 0).getRGB()); + RenderUtil.drawRoundedOutline(x + spacing, crossY - 1, 22, 22, 5, 3, -1); RenderUtil.waitDrawImage(new ResourceLocation("silentclient/mods/crosshair/crosshair" + selected + ".png"), x + spacing + ((22 / 2) - (15 / 2)), crossY - 1 + ((22 / 2) - (15 / 2)), 15, 15, false); spacing += 25; @@ -176,7 +176,7 @@ public class CrosshairMod extends Mod { RenderUtil.drawRoundedRect(x + spacing, crossY - 1, x + spacing + 22, crossY - 1 + 22, 5, new Color(0, 0, 0).getRGB()); if(MouseUtils.isInside(mouseX, mouseY, x + spacing, crossY - 1, 22, 22)) { - RenderUtil.drawRoundedOutline(x + spacing, crossY - 1, x + spacing + 22, crossY - 1 + 22, 5, 3, new Color(255, 255, 255, 127).getRGB()); + RenderUtil.drawRoundedOutline(x + spacing, crossY - 1, 22, 22, 5, 3, new Color(255, 255, 255, 127).getRGB()); } RenderUtil.waitDrawImage(new ResourceLocation("silentclient/mods/crosshair/crosshair" + presetID + ".png"), x + spacing + ((22 / 2) - (15 / 2)), crossY - 1 + ((22 / 2) - (15 / 2)), 15, 15, false); diff --git a/src/main/java/net/silentclient/client/premium/PremiumGui.java b/src/main/java/net/silentclient/client/premium/PremiumGui.java index 90e199e..dc52057 100644 --- a/src/main/java/net/silentclient/client/premium/PremiumGui.java +++ b/src/main/java/net/silentclient/client/premium/PremiumGui.java @@ -1,14 +1,5 @@ package net.silentclient.client.premium; -import java.awt.Color; -import java.io.IOException; -import java.net.URI; -import java.util.ArrayList; - -import net.silentclient.client.utils.MenuBlurUtils; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; - import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; @@ -22,17 +13,21 @@ import net.silentclient.client.gui.clickgui.utils.MouseUtils; import net.silentclient.client.gui.clickgui.utils.RenderUtils; import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.Checkbox; -import net.silentclient.client.gui.elements.ColorPicker; -import net.silentclient.client.gui.elements.Input; -import net.silentclient.client.gui.elements.StaticButton; +import net.silentclient.client.gui.elements.*; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.hud.HUDConfigScreen; import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.gui.util.RenderUtil; -import net.silentclient.client.gui.util.RoundedUtils; -import net.silentclient.client.mods.settings.GeneralMod; import net.silentclient.client.utils.ColorUtils; +import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.Sounds; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import java.awt.*; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; public class PremiumGui { public static void drawScreen(int x, int y, int width, int height, int mouseX, int mouseY, float partialTicks, Input input) { @@ -167,7 +162,7 @@ public class PremiumGui { int height = addY * 2; GlStateManager.pushMatrix(); GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue()); - RoundedUtils.drawRoundedRect(x, y, x + width, y + height, 10, Theme.backgroundColor().getRGB()); + RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB()); GL11.glPushMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/src/main/java/net/silentclient/client/utils/FileUtils.java b/src/main/java/net/silentclient/client/utils/FileUtils.java index e14791a..b57ba88 100644 --- a/src/main/java/net/silentclient/client/utils/FileUtils.java +++ b/src/main/java/net/silentclient/client/utils/FileUtils.java @@ -1,8 +1,7 @@ package net.silentclient.client.utils; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; +import java.io.*; import javax.imageio.ImageIO; @@ -11,6 +10,21 @@ import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.util.ResourceLocation; public class FileUtils { + public static String readInputStream(InputStream inputStream) { + StringBuilder stringBuilder = new StringBuilder(); + + try { + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + String line; + while ((line = bufferedReader.readLine()) != null) + stringBuilder.append(line).append('\n'); + + } catch (Exception e) { + e.printStackTrace(); + } + return stringBuilder.toString(); + } + public static ResourceLocation fileToResourceLocation(File file) { ResourceLocation location = null; BufferedImage img = null;