Skip to content

Commit

Permalink
Consistently draw text with shadows (#721)
Browse files Browse the repository at this point in the history
- Fixed text now having shadows properly
  • Loading branch information
haykam821 authored Jun 15, 2024
1 parent a1f017f commit 845cad7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,17 +313,17 @@ public void render(DrawContext DrawContext, int mouseX, int mouseY, float delta)
if (!ModMenuConfig.CONFIG_MODE.getValue() && this.updateFiltersX()) {
if (this.filterOptionsShown) {
if (!ModMenuConfig.SHOW_LIBRARIES.getValue() || textRenderer.getWidth(fullModCount) <= this.filtersX - 5) {
DrawContext.drawText(textRenderer, fullModCount.asOrderedText(), this.searchBoxX, 52, 0xFFFFFF, false);
DrawContext.drawText(textRenderer, fullModCount.asOrderedText(), this.searchBoxX, 52, 0xFFFFFF, true);
} else {
DrawContext.drawText(textRenderer, computeModCountText(false).asOrderedText(), this.searchBoxX, 46, 0xFFFFFF, false);
DrawContext.drawText(textRenderer, computeLibraryCountText().asOrderedText(), this.searchBoxX, 57, 0xFFFFFF, false);
DrawContext.drawText(textRenderer, computeModCountText(false).asOrderedText(), this.searchBoxX, 46, 0xFFFFFF, true);
DrawContext.drawText(textRenderer, computeLibraryCountText().asOrderedText(), this.searchBoxX, 57, 0xFFFFFF, true);
}
} else {
if (!ModMenuConfig.SHOW_LIBRARIES.getValue() || textRenderer.getWidth(fullModCount) <= modList.getWidth() - 5) {
DrawContext.drawText(textRenderer, fullModCount.asOrderedText(), this.searchBoxX, 52, 0xFFFFFF, false);
DrawContext.drawText(textRenderer, fullModCount.asOrderedText(), this.searchBoxX, 52, 0xFFFFFF, true);
} else {
DrawContext.drawText(textRenderer, computeModCountText(false).asOrderedText(), this.searchBoxX, 46, 0xFFFFFF, false);
DrawContext.drawText(textRenderer, computeLibraryCountText().asOrderedText(), this.searchBoxX, 57, 0xFFFFFF, false);
DrawContext.drawText(textRenderer, computeModCountText(false).asOrderedText(), this.searchBoxX, 46, 0xFFFFFF, true);
DrawContext.drawText(textRenderer, computeLibraryCountText().asOrderedText(), this.searchBoxX, 57, 0xFFFFFF, true);
}
}
}
Expand All @@ -347,7 +347,7 @@ public void render(DrawContext DrawContext, int mouseX, int mouseY, float delta)
StringVisitable ellipsis = StringVisitable.plain("...");
trimmedName = StringVisitable.concat(textRenderer.trimToWidth(name, maxNameWidth - textRenderer.getWidth(ellipsis)), ellipsis);
}
DrawContext.drawText(textRenderer, Language.getInstance().reorder(trimmedName), x + imageOffset, RIGHT_PANE_Y + 1, 0xFFFFFF, false);
DrawContext.drawText(textRenderer, Language.getInstance().reorder(trimmedName), x + imageOffset, RIGHT_PANE_Y + 1, 0xFFFFFF, true);
if (mouseX > x + imageOffset && mouseY > RIGHT_PANE_Y + 1 && mouseY < RIGHT_PANE_Y + 1 + textRenderer.fontHeight && mouseX < x + imageOffset + textRenderer.getWidth(trimmedName)) {
this.setTooltip(ModMenuScreenTexts.modIdTooltip(mod.getId()));
}
Expand All @@ -359,7 +359,7 @@ public void render(DrawContext DrawContext, int mouseX, int mouseY, float delta)
modBadgeRenderer.draw(DrawContext, mouseX, mouseY);
}
if (mod.isReal()) {
DrawContext.drawText(textRenderer, mod.getPrefixedVersion(), x + imageOffset, RIGHT_PANE_Y + 2 + lineSpacing, 0x808080, false);
DrawContext.drawText(textRenderer, mod.getPrefixedVersion(), x + imageOffset, RIGHT_PANE_Y + 2 + lineSpacing, 0x808080, true);
}
String authors;
List<String> names = mod.getAuthors();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void render(DrawContext DrawContext, int index, int y, int x, int rowWidt
StringVisitable ellipsis = StringVisitable.plain("...");
trimmedName = StringVisitable.concat(font.trimToWidth(name, maxNameWidth - font.getWidth(ellipsis)), ellipsis);
}
DrawContext.drawText(font, Language.getInstance().reorder(trimmedName), x + iconSize + 3, y + 1, 0xFFFFFF, false);
DrawContext.drawText(font, Language.getInstance().reorder(trimmedName), x + iconSize + 3, y + 1, 0xFFFFFF, true);
var updateBadgeXOffset = 0;
if (ModMenuConfig.UPDATE_CHECKER.getValue() && !ModMenuConfig.DISABLE_UPDATE_CHECKER.getValue().contains(modId) && (mod.hasUpdate() || mod.getChildHasUpdate())) {
UpdateAvailableBadge.renderBadge(DrawContext, x + iconSize + 3 + font.getWidth(name) + 2, y);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void drawWrappedString(DrawContext DrawContext, String string, int
int width = CLIENT.textRenderer.getWidth(line);
x1 += (float) (wrapWidth - width);
}
DrawContext.drawText(CLIENT.textRenderer, line, x1, y + i * CLIENT.textRenderer.fontHeight, color, false);
DrawContext.drawText(CLIENT.textRenderer, line, x1, y + i * CLIENT.textRenderer.fontHeight, color, true);
}
}

Expand Down

0 comments on commit 845cad7

Please sign in to comment.