aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorKendell R <KTibow@users.noreply.github.com>2022-06-12 03:19:26 -0700
committerGitHub <noreply@github.com>2022-06-12 12:19:26 +0200
commitcf8b1a7f962ad3a9c31e6698fb7caf82aac42a18 (patch)
tree1159e45ee04d6e5e46b6d1effeb4cda49b50aebd /src/main
parent0f853804ef7c626e9c31749d6f948aa6bb23f4db (diff)
downloadOneConfig-cf8b1a7f962ad3a9c31e6698fb7caf82aac42a18.tar.gz
OneConfig-cf8b1a7f962ad3a9c31e6698fb7caf82aac42a18.tar.bz2
OneConfig-cf8b1a7f962ad3a9c31e6698fb7caf82aac42a18.zip
fix card rendering (#41)
* attempt to remove colors will this even work idk * fix rendering
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java5
1 files changed, 3 insertions, 2 deletions
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);