Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/main/java/shortestpath/PathTileOverlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ public Dimension render(Graphics2D graphics) {
}

if (config.drawTiles() && plugin.path != null) {
int i = 0;
for (WorldPoint point : plugin.path) {
drawTile(graphics, point, new Color(255, 0, 0, 128));
drawTile(graphics, point, ++i, new Color(255, 0, 0, 128));
}
}

Expand Down Expand Up @@ -116,7 +117,7 @@ private Point tileCenter(WorldPoint b) {
return new Point(cx, cy);
}

private void drawTile(Graphics2D graphics, WorldPoint point, Color color) {
private void drawTile(Graphics2D graphics, WorldPoint point, int i, Color color) {
if (point.getPlane() != client.getPlane()) {
return;
}
Expand All @@ -133,5 +134,13 @@ private void drawTile(Graphics2D graphics, WorldPoint point, Color color) {

graphics.setColor(color);
graphics.fill(poly);

if (config.drawTileNumbers()) {
String s = "" + i;
graphics.setColor(Color.WHITE);
int stringX = (int) (poly.getBounds().getCenterX() - graphics.getFontMetrics().getStringBounds(s, graphics).getWidth() / 2);
int stringY = (int) poly.getBounds().getCenterY();
graphics.drawString(s, stringX, stringY);
}
}
}
5 changes: 5 additions & 0 deletions src/main/java/shortestpath/ShortestPathConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ default boolean drawTiles() {
return true;
}

@ConfigItem(keyName = "drawTileNumbers", name = "Draw tile numbers on tiles", description = "Whether the tile number should be drawn on the game tiles")
default boolean drawTileNumbers() {
return true;
}

@ConfigItem(keyName = "drawMinimap", name = "Draw path on minimap", description = "Whether the path should be drawn on the minimap")
default boolean drawMinimap() {
return true;
Expand Down