From 261ad63308928e67e503e7a61c3d2a385b23b6cf Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Sun, 31 Dec 2023 12:47:53 +0600 Subject: [PATCH] Rounded Corners --- .../net/silentclient/client/mods/HudMod.java | 9 +++- .../client/mods/hud/KeystrokesMod.java | 51 ++++++++++++++----- .../client/mods/player/AutoSprintMod.java | 7 +-- 3 files changed, 50 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/silentclient/client/mods/HudMod.java b/src/main/java/net/silentclient/client/mods/HudMod.java index 000aaa6..b55d8f5 100644 --- a/src/main/java/net/silentclient/client/mods/HudMod.java +++ b/src/main/java/net/silentclient/client/mods/HudMod.java @@ -3,6 +3,7 @@ package net.silentclient.client.mods; import net.silentclient.client.Client; import net.silentclient.client.gui.hud.ScreenPosition; import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; +import net.silentclient.client.gui.util.RenderUtil; import java.awt.*; @@ -33,6 +34,7 @@ public class HudMod extends ModDraggable { this.addBooleanSetting("Font Shadow", this, true); this.addBooleanSetting("Brackets", this, false); this.addBooleanSetting("Fancy Font", this, false); + this.addBooleanSetting("Rounded Corners", this, false); } public String getText() { @@ -100,13 +102,18 @@ public class HudMod extends ModDraggable { font.setRenderMode(fancyFont ? CustomFontRenderer.RenderMode.CUSTOM : CustomFontRenderer.RenderMode.DEFAULT); boolean background = Client.getInstance().getSettingsManager().getSettingByName(this, "Background").getValBoolean(); + boolean roundedCorners = Client.getInstance().getSettingsManager().getSettingByName(this, "Rounded Corners").getValBoolean(); Color backgroundColor = Client.getInstance().getSettingsManager().getSettingByName(this, "Background Color").getValColor(); boolean fontShadow = Client.getInstance().getSettingsManager().getSettingByName(this, "Font Shadow").getValBoolean(); boolean brackets = Client.getInstance().getSettingsManager().getSettingByName(this, "Brackets").getValBoolean(); Color color = Client.getInstance().getSettingsManager().getSettingByName(this, "Color").getValColor(); preRender(); if(background) { - RenderUtils.drawRect(getX(), getY(), this.getRealWidth(), this.getHeight(), backgroundColor.getRGB()); + if(roundedCorners) { + RenderUtil.drawRoundedRect(getX(), getY(), this.getRealWidth(), this.getHeight(), 6, backgroundColor.getRGB()); + } else { + RenderUtils.drawRect(getX(), getY(), this.getRealWidth(), this.getHeight(), backgroundColor.getRGB()); + } } if(!background) { diff --git a/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java b/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java index c1500a0..04317fe 100644 --- a/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java +++ b/src/main/java/net/silentclient/client/mods/hud/KeystrokesMod.java @@ -10,6 +10,7 @@ import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.hud.ScreenPosition; import net.silentclient.client.gui.lite.clickgui.utils.GlUtils; import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; +import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mods.CustomFontRenderer; import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.ModDraggable; @@ -37,6 +38,7 @@ public class KeystrokesMod extends ModDraggable { this.addBooleanSetting("Font Shadow", this, true); this.addBooleanSetting("Fancy Font", this, false); this.addBooleanSetting("Background", this, true); + this.addBooleanSetting("Rounded Corners", this, false); this.addModeSetting("CPS Mode", this, "Small", cpsModes); this.addColorSetting("Color", this, new Color(255, 255, 255)); this.addColorSetting("Background Color", this, new Color(0, 0, 0), 127); @@ -182,7 +184,8 @@ public class KeystrokesMod extends ModDraggable { Color color = Client.getInstance().getSettingsManager().getSettingByName(this, "Color").getValColor(); Color clickedColor = Client.getInstance().getSettingsManager().getSettingByName(this, "Clicked Color").getValColor(); int fadeDelay = Client.getInstance().getSettingsManager().getSettingByName(this, "Fade Delay").getValInt() != 0 ? 100000 / Client.getInstance().getSettingsManager().getSettingByName(this, "Fade Delay").getValInt() : 0; - + boolean roundedCorners = Client.getInstance().getSettingsManager().getSettingByName(this, "Rounded Corners").getValBoolean(); + for(Key key : mode.getKeys()) { String renderString = key.getName(); @@ -202,13 +205,24 @@ public class KeystrokesMod extends ModDraggable { setAnimation(key.green, key.isDown() ? clickedBackgroundColor.getGreen() : backgroundColor.getGreen(), fadeDelay); setAnimation(key.blue, key.isDown() ? clickedBackgroundColor.getBlue() : backgroundColor.getBlue(), fadeDelay); setAnimation(key.alpha, key.isDown() ? clickedBackgroundColor.getAlpha() : backgroundColor.getAlpha(), fadeDelay); - RenderUtils.drawRect( - 0 + key.getX(), - 0 + key.getY(), - key.getWidth(), - key.getHeight(), - new Color((int) key.red.getValue(), (int) key.green.getValue(), (int) key.blue.getValue(), (int) key.alpha.getValue()).getRGB() + if(roundedCorners) { + RenderUtil.drawRoundedRect( + key.getX(), + key.getY(), + key.getWidth(), + key.getHeight(), + 6, + new Color((int) key.red.getValue(), (int) key.green.getValue(), (int) key.blue.getValue(), (int) key.alpha.getValue()).getRGB() ); + } else { + RenderUtils.drawRect( + key.getX(), + key.getY(), + key.getWidth(), + key.getHeight(), + new Color((int) key.red.getValue(), (int) key.green.getValue(), (int) key.blue.getValue(), (int) key.alpha.getValue()).getRGB() + ); + } ColorUtils.setColor(-1); } @@ -294,13 +308,24 @@ public class KeystrokesMod extends ModDraggable { setAnimation(Space.green, Space.isDown() ? clickedBackgroundColor.getGreen() : backgroundColor.getGreen(), fadeDelay); setAnimation(Space.blue, Space.isDown() ? clickedBackgroundColor.getBlue() : backgroundColor.getBlue(), fadeDelay); setAnimation(Space.alpha, Space.isDown() ? clickedBackgroundColor.getAlpha() : backgroundColor.getAlpha(), fadeDelay); - RenderUtils.drawRect( - 0, - 0 + mode.getHeight() + 2, - mode.getWidth(), - 10, - new Color((int) Space.red.getValue(), (int) Space.green.getValue(), (int) Space.blue.getValue(), (int) Space.alpha.getValue()).getRGB() + if(roundedCorners) { + RenderUtil.drawRoundedRect( + 0, + 0 + mode.getHeight() + 2, + mode.getWidth(), + 10, + 6, + new Color((int) Space.red.getValue(), (int) Space.green.getValue(), (int) Space.blue.getValue(), (int) Space.alpha.getValue()).getRGB() ); + } else { + RenderUtils.drawRect( + 0, + 0 + mode.getHeight() + 2, + mode.getWidth(), + 10, + new Color((int) Space.red.getValue(), (int) Space.green.getValue(), (int) Space.blue.getValue(), (int) Space.alpha.getValue()).getRGB() + ); + } ColorUtils.setColor(-1); } font.drawString( diff --git a/src/main/java/net/silentclient/client/mods/player/AutoSprintMod.java b/src/main/java/net/silentclient/client/mods/player/AutoSprintMod.java index 7d0485e..1644969 100644 --- a/src/main/java/net/silentclient/client/mods/player/AutoSprintMod.java +++ b/src/main/java/net/silentclient/client/mods/player/AutoSprintMod.java @@ -1,8 +1,5 @@ package net.silentclient.client.mods.player; -import java.awt.Color; -import java.util.ArrayList; - import net.minecraft.client.settings.KeyBinding; import net.silentclient.client.Client; import net.silentclient.client.event.EventTarget; @@ -12,6 +9,9 @@ import net.silentclient.client.gui.hud.ScreenPosition; import net.silentclient.client.mods.HudMod; import net.silentclient.client.mods.ModCategory; +import java.awt.*; +import java.util.ArrayList; + public class AutoSprintMod extends HudMod { private boolean toggled = false; @@ -30,6 +30,7 @@ public class AutoSprintMod extends HudMod { this.addBooleanSetting("Font Shadow", this, true); this.addBooleanSetting("Brackets", this, true); this.addBooleanSetting("Fancy Font", this, false); + this.addBooleanSetting("Rounded Corners", this, false); ArrayList options = new ArrayList(); options.add("Toggle"); options.add("Auto");