From cf8b1a7f962ad3a9c31e6698fb7caf82aac42a18 Mon Sep 17 00:00:00 2001 From: Kendell R Date: Sun, 12 Jun 2022 03:19:26 -0700 Subject: fix card rendering (#41) * attempt to remove colors will this even work idk * fix rendering --- src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/java/cc/polyfrost') diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java index e5d187f..ac12f07 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java @@ -44,6 +44,7 @@ public class ModCard extends BasicElement { @Override public void draw(long vg, int x, int y) { super.update(x, y); + String cleanName = modData.name.replaceAll("ยง.", ""); Scissor scissor = ScissorManager.scissor(vg, x, y, width, height); isHoveredMain = InputUtils.isAreaHovered(x, y, width, 87); @@ -57,11 +58,11 @@ public class ModCard extends BasicElement { RenderManager.drawSvg(vg, modData.modIcon, x + 98, y + 19, 48, 48); else RenderManager.drawImage(vg, modData.modIcon, x + 98, y + 19, 48, 48); } else { - RenderManager.drawText(vg, modData.name, x + 122 - RenderManager.getTextWidth(vg, modData.name, 16, Fonts.MINECRAFT_BOLD) / 2f, y + 44, ColorUtils.setAlpha(Colors.WHITE, (int) (colorFrame.getAlpha() * 255)), 16, Fonts.MINECRAFT_BOLD); + RenderManager.drawText(vg, cleanName, x + Math.max(0, (244 - RenderManager.getTextWidth(vg, cleanName, 16, Fonts.MINECRAFT_BOLD))) / 2f, y + 44, ColorUtils.setAlpha(Colors.WHITE, (int) (colorFrame.getAlpha() * 255)), 16, Fonts.MINECRAFT_BOLD); } favoriteButton.draw(vg, x + 212, y + 87); favorite = favoriteButton.isToggled(); - RenderManager.drawText(vg, modData.name, x + 12, y + 103, ColorUtils.setAlpha(Colors.WHITE, (int) (colorToggle.getAlpha() * 255)), 14f, Fonts.MEDIUM); + RenderManager.drawText(vg, cleanName, x + 12, y + 103, ColorUtils.setAlpha(Colors.WHITE, (int) (colorToggle.getAlpha() * 255)), 14f, Fonts.MEDIUM); if (favorite) favoriteButton.setLeftIcon(SVGs.HEART_FILL); else favoriteButton.setLeftIcon(SVGs.HEART_OUTLINE); -- cgit