overlayrenderer: Fix font styles not applying
This commit is contained in:
@@ -28,7 +28,6 @@ import com.google.common.base.MoreObjects;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Composite;
|
import java.awt.Composite;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Paint;
|
import java.awt.Paint;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
@@ -51,7 +50,6 @@ import net.runelite.api.MenuOpcode;
|
|||||||
import net.runelite.api.MenuEntry;
|
import net.runelite.api.MenuEntry;
|
||||||
import net.runelite.api.events.BeforeRender;
|
import net.runelite.api.events.BeforeRender;
|
||||||
import net.runelite.api.events.ClientTick;
|
import net.runelite.api.events.ClientTick;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
|
||||||
import net.runelite.api.events.FocusChanged;
|
import net.runelite.api.events.FocusChanged;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
@@ -97,10 +95,6 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
|||||||
private boolean isResizeable;
|
private boolean isResizeable;
|
||||||
private OverlayBounds snapCorners;
|
private OverlayBounds snapCorners;
|
||||||
|
|
||||||
private Font standardFont;
|
|
||||||
private Font tooltipFont;
|
|
||||||
private Font interfaceFont;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OverlayRenderer(
|
private OverlayRenderer(
|
||||||
final Client client,
|
final Client client,
|
||||||
@@ -113,32 +107,14 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
|||||||
this.client = client;
|
this.client = client;
|
||||||
this.overlayManager = overlayManager;
|
this.overlayManager = overlayManager;
|
||||||
this.runeLiteConfig = runeLiteConfig;
|
this.runeLiteConfig = runeLiteConfig;
|
||||||
this.updateConfig();
|
|
||||||
keyManager.registerKeyListener(this);
|
keyManager.registerKeyListener(this);
|
||||||
mouseManager.registerMouseListener(this);
|
mouseManager.registerMouseListener(this);
|
||||||
|
|
||||||
eventbus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
|
||||||
eventbus.subscribe(FocusChanged.class, this, this::onFocusChanged);
|
eventbus.subscribe(FocusChanged.class, this, this::onFocusChanged);
|
||||||
eventbus.subscribe(ClientTick.class, this, this::onClientTick);
|
eventbus.subscribe(ClientTick.class, this, this::onClientTick);
|
||||||
eventbus.subscribe(BeforeRender.class, this, this::onBeforeRender);
|
eventbus.subscribe(BeforeRender.class, this, this::onBeforeRender);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateConfig()
|
|
||||||
{
|
|
||||||
// Overlay Fonts
|
|
||||||
this.standardFont = runeLiteConfig.fontType().getFont();
|
|
||||||
this.tooltipFont = runeLiteConfig.tooltipFontType().getFont();
|
|
||||||
this.interfaceFont = runeLiteConfig.interfaceFontType().getFont();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onConfigChanged(ConfigChanged event)
|
|
||||||
{
|
|
||||||
if (event.getGroup().equals("runelite"))
|
|
||||||
{
|
|
||||||
updateConfig();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void onFocusChanged(FocusChanged event)
|
private void onFocusChanged(FocusChanged event)
|
||||||
{
|
{
|
||||||
if (!event.isFocused())
|
if (!event.isFocused())
|
||||||
@@ -514,16 +490,15 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
|||||||
// Set font based on configuration
|
// Set font based on configuration
|
||||||
if (position == OverlayPosition.DYNAMIC || position == OverlayPosition.DETACHED)
|
if (position == OverlayPosition.DYNAMIC || position == OverlayPosition.DETACHED)
|
||||||
{
|
{
|
||||||
graphics.setFont(this.standardFont); // TODO MAKE USE CONFIG SYSTEM
|
graphics.setFont(runeLiteConfig.fontType().getFont());
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (position == OverlayPosition.TOOLTIP)
|
else if (position == OverlayPosition.TOOLTIP)
|
||||||
{
|
{
|
||||||
graphics.setFont(this.tooltipFont);
|
graphics.setFont(runeLiteConfig.tooltipFontType().getFont());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
graphics.setFont(this.interfaceFont);
|
graphics.setFont(runeLiteConfig.interfaceFontType().getFont());
|
||||||
}
|
}
|
||||||
|
|
||||||
graphics.translate(point.x, point.y);
|
graphics.translate(point.x, point.y);
|
||||||
|
|||||||
Reference in New Issue
Block a user