fps plugin: move fps off logout button on bottom line mode
This commit is contained in:
@@ -31,6 +31,8 @@ import javax.inject.Inject;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.events.FocusChanged;
|
import net.runelite.api.events.FocusChanged;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
@@ -48,7 +50,7 @@ import net.runelite.client.ui.overlay.OverlayUtil;
|
|||||||
public class FpsOverlay extends Overlay
|
public class FpsOverlay extends Overlay
|
||||||
{
|
{
|
||||||
private static final int Y_OFFSET = 1;
|
private static final int Y_OFFSET = 1;
|
||||||
private static final int VALUE_X_OFFSET = 1;
|
private static final int X_OFFSET = 1;
|
||||||
private static final String FPS_STRING = " FPS";
|
private static final String FPS_STRING = " FPS";
|
||||||
|
|
||||||
// Local dependencies
|
// Local dependencies
|
||||||
@@ -91,13 +93,22 @@ public class FpsOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// On resizable bottom line mode the logout button is at the top right, so offset the overlay
|
||||||
|
// to account for it
|
||||||
|
Widget logoutButton = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_LOGOUT_BUTTON);
|
||||||
|
int xOffset = X_OFFSET;
|
||||||
|
if (logoutButton != null && !logoutButton.isHidden())
|
||||||
|
{
|
||||||
|
xOffset += logoutButton.getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
final String text = client.getFPS() + FPS_STRING;
|
final String text = client.getFPS() + FPS_STRING;
|
||||||
final int textWidth = graphics.getFontMetrics().stringWidth(text);
|
final int textWidth = graphics.getFontMetrics().stringWidth(text);
|
||||||
final int textHeight = graphics.getFontMetrics().getAscent() - graphics.getFontMetrics().getDescent();
|
final int textHeight = graphics.getFontMetrics().getAscent() - graphics.getFontMetrics().getDescent();
|
||||||
|
|
||||||
final int width = (int) client.getRealDimensions().getWidth();
|
final int width = (int) client.getRealDimensions().getWidth();
|
||||||
final Point point = new Point(width - textWidth - VALUE_X_OFFSET, textHeight + Y_OFFSET);
|
final Point point = new Point(width - textWidth - xOffset, textHeight + Y_OFFSET);
|
||||||
OverlayUtil.renderTextLocation(graphics, point, text, getFpsValueColor());
|
OverlayUtil.renderTextLocation(graphics, point, text, getFpsValueColor());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user