status bars: Add counter text drop shadow

This drop shadow was present prior to the plugin refactor in
1165780f42 which erroneously removed it.
This commit is contained in:
Jordan Atwood
2021-05-03 00:16:18 -07:00
committed by Adam
parent 3f7146a6c2
commit d69a5ddd8b

View File

@@ -25,12 +25,14 @@
*/ */
package net.runelite.client.plugins.statusbars; package net.runelite.client.plugins.statusbars;
import lombok.RequiredArgsConstructor;
import net.runelite.client.ui.FontManager;
import java.awt.Color; import java.awt.Color;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Image; import java.awt.Image;
import java.awt.Point;
import java.util.function.Supplier; import java.util.function.Supplier;
import lombok.RequiredArgsConstructor;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.components.TextComponent;
@RequiredArgsConstructor @RequiredArgsConstructor
class BarRenderer class BarRenderer
@@ -100,28 +102,26 @@ class BarRenderer
private void renderIconsAndCounters(StatusBarsConfig config, Graphics2D graphics, int x, int y) private void renderIconsAndCounters(StatusBarsConfig config, Graphics2D graphics, int x, int y)
{ {
graphics.setFont(FontManager.getRunescapeSmallFont()); final boolean skillIconEnabled = config.enableSkillIcon();
graphics.setColor(Color.WHITE);
String counterText = Integer.toString(currentValue); if (skillIconEnabled)
final int widthOfCounter = graphics.getFontMetrics().stringWidth(counterText); {
int centerText = (WIDTH - PADDING) / 2 - (widthOfCounter / 2); final Image icon = iconSupplier.get();
final Image icon = iconSupplier.get(); graphics.drawImage(icon, x + ICON_AND_COUNTER_OFFSET_X + PADDING, y + ICON_AND_COUNTER_OFFSET_Y - icon.getWidth(null), null);
}
if (config.enableCounter()) if (config.enableCounter())
{ {
if (config.enableSkillIcon()) graphics.setFont(FontManager.getRunescapeSmallFont());
{ final String counterText = Integer.toString(currentValue);
graphics.drawImage(icon, x + ICON_AND_COUNTER_OFFSET_X + PADDING, y + ICON_AND_COUNTER_OFFSET_Y - icon.getWidth(null), null); final int widthOfCounter = graphics.getFontMetrics().stringWidth(counterText);
graphics.drawString(counterText, x + centerText + PADDING, y + SKILL_ICON_HEIGHT); final int centerText = (WIDTH - PADDING) / 2 - (widthOfCounter / 2);
} final int yOffset = skillIconEnabled ? SKILL_ICON_HEIGHT : COUNTER_ICON_HEIGHT;
else
{ final TextComponent textComponent = new TextComponent();
graphics.drawString(counterText, x + centerText + PADDING, y + COUNTER_ICON_HEIGHT); textComponent.setText(counterText);
} textComponent.setPosition(new Point(x + centerText + PADDING, y + yOffset));
} textComponent.render(graphics);
else if (config.enableSkillIcon())
{
graphics.drawImage(icon, x + ICON_AND_COUNTER_OFFSET_X + PADDING, y + ICON_AND_COUNTER_OFFSET_Y - icon.getWidth(null), null);
} }
} }