Rounded Corners

This commit is contained in:
kirillsaint 2023-12-31 12:47:53 +06:00
parent 131222238e
commit 261ad63308
3 changed files with 50 additions and 17 deletions

View File

@ -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) {

View File

@ -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(

View File

@ -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<String> options = new ArrayList<String>();
options.add("Toggle");
options.add("Auto");