diff options
| author | Danielshe <shekwancheung0528@gmail.com> | 2019-11-03 14:44:52 +0800 |
|---|---|---|
| committer | Danielshe <shekwancheung0528@gmail.com> | 2019-11-03 14:44:59 +0800 |
| commit | 9f5a9eae9a7863412cc5eb433bf15e5ee71da616 (patch) | |
| tree | 0e6b0b94af061c5e9023b1ff19f339a6c30149be /src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java | |
| parent | 3e3e25855b9f6df507a7d4c8a07c64b9a502fae2 (diff) | |
| download | RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.gz RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.bz2 RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.zip | |
3.2.1
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java index 447789b52..1a0ef30b3 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java @@ -27,10 +27,14 @@ public abstract class ClickableLabelWidget extends LabelWidget { @Override public void render(int mouseX, int mouseY, float delta) { - int colour = getDefaultColor(); + int color = getDefaultColor(); if (clickable && isHovered(mouseX, mouseY)) - colour = getHoveredColor(); - drawCenteredString(font, (isHovered(mouseX, mouseY) ? Formatting.UNDERLINE.toString() : "") + text, x, y, colour); + color = getHoveredColor(); + int width = font.getStringWidth(text); + if (isHasShadows()) + font.drawWithShadow((isHovered(mouseX, mouseY) ? Formatting.UNDERLINE.toString() : "") + text, x - width / 2, y, color); + else + font.draw((isHovered(mouseX, mouseY) ? Formatting.UNDERLINE.toString() : "") + text, x - width / 2, y, color); if (clickable && getTooltips().isPresent()) if (!focused && containsMouse(mouseX, mouseY)) ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(getTooltips().get().split("\n"))); @@ -38,10 +42,6 @@ public abstract class ClickableLabelWidget extends LabelWidget { ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(new Point(x, y), getTooltips().get().split("\n"))); } - public int getDefaultColor() { - return ScreenHelper.isDarkModeEnabled() ? 0xFFBBBBBB : -1; - } - public int getHoveredColor() { return ScreenHelper.isDarkModeEnabled() ? -1 : 0xFF66FFCC; } |
