This commit is contained in:
Thomas Cylke
2019-09-28 11:44:32 -04:00
committed by Kyle
parent 4aa24c7737
commit 9258c8eff8
10 changed files with 162 additions and 17 deletions

View File

@@ -283,4 +283,15 @@ public interface GroundMarkerConfig extends Config
{ {
return 100; return 100;
} }
@ConfigItem(
position = 16,
keyName = "thinMarkers",
name = "Thin markesr",
description = "Render marked tile borders as 1 pixel wide instead of 2"
)
default boolean thinMarkers()
{
return false;
}
} }

View File

@@ -126,6 +126,13 @@ public class GroundMarkerOverlay extends Overlay
case 12: case 12:
color = plugin.getMarkerColor12(); color = plugin.getMarkerColor12();
} }
if (plugin.isThinMarkers())
{
OverlayUtil.renderPolygonThin(graphics, poly, color);
}
else
{
OverlayUtil.renderPolygon(graphics, poly, color); OverlayUtil.renderPolygon(graphics, poly, color);
} }
}
} }

View File

@@ -173,6 +173,8 @@ public class GroundMarkerPlugin extends Plugin
private boolean showMinimap; private boolean showMinimap;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private int minimapOverlayOpacity; private int minimapOverlayOpacity;
@Getter(AccessLevel.PACKAGE)
private boolean thinMarkers;
@Provides @Provides
GroundMarkerConfig provideConfig(ConfigManager configManager) GroundMarkerConfig provideConfig(ConfigManager configManager)
@@ -509,5 +511,6 @@ public class GroundMarkerPlugin extends Plugin
this.markerColor12 = config.markerColor12(); this.markerColor12 = config.markerColor12();
this.showMinimap = config.showMinimap(); this.showMinimap = config.showMinimap();
this.minimapOverlayOpacity = config.minimapOverlayOpacity(); this.minimapOverlayOpacity = config.minimapOverlayOpacity();
this.thinMarkers = config.thinMarkers();
} }
} }

View File

@@ -121,4 +121,15 @@ public interface MultiIndicatorsConfig extends Config
return Color.WHITE; return Color.WHITE;
} }
@ConfigItem(
keyName = "thinnerLines",
name = "Thin lines",
description = "Render multi lines, safe zone lines, and wildy level lines as 1 pixel wide instead of 2",
position = 9
)
default boolean thinnerLines()
{
return false;
}
} }

View File

@@ -63,9 +63,16 @@ public class MultiIndicatorsOverlay extends Overlay
} }
private Color getTransparentColorVersion(Color c) private Color getTransparentColorVersion(Color c)
{
if (plugin.isThinnerLines()) //The thin lines are difficult to see with low opacity, but they are visible and less obtrusive with full opacity
{
return c;
}
else
{ {
return new Color(c.getRed(), c.getGreen(), c.getBlue(), 92); return new Color(c.getRed(), c.getGreen(), c.getBlue(), 92);
} }
}
private void renderPath(Graphics2D graphics, GeneralPath path, Color color) private void renderPath(Graphics2D graphics, GeneralPath path, Color color)
{ {
@@ -77,8 +84,14 @@ public class MultiIndicatorsOverlay extends Overlay
MAX_LOCAL_DRAW_LENGTH * 2); MAX_LOCAL_DRAW_LENGTH * 2);
graphics.setColor(color); graphics.setColor(color);
if (plugin.isThinnerLines())
{
graphics.setStroke(new BasicStroke(1));
}
else
{
graphics.setStroke(new BasicStroke(2)); graphics.setStroke(new BasicStroke(2));
}
path = Geometry.clipPath(path, viewArea); path = Geometry.clipPath(path, viewArea);
path = Geometry.filterPath(path, (p1, p2) -> path = Geometry.filterPath(path, (p1, p2) ->
Perspective.localToCanvas(client, new LocalPoint((int) p1[0], (int) p1[1]), client.getPlane()) != null && Perspective.localToCanvas(client, new LocalPoint((int) p1[0], (int) p1[1]), client.getPlane()) != null &&

View File

@@ -120,6 +120,8 @@ public class MultiIndicatorsPlugin extends Plugin
private Color safeZoneColor; private Color safeZoneColor;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private Color wildernessLevelLinesColor; private Color wildernessLevelLinesColor;
@Getter(AccessLevel.PACKAGE)
private boolean thinnerLines;
@Provides @Provides
MultiIndicatorsConfig getConfig(ConfigManager configManager) MultiIndicatorsConfig getConfig(ConfigManager configManager)
@@ -407,5 +409,6 @@ public class MultiIndicatorsPlugin extends Plugin
this.multicombatColor = config.multicombatColor(); this.multicombatColor = config.multicombatColor();
this.safeZoneColor = config.safeZoneColor(); this.safeZoneColor = config.safeZoneColor();
this.wildernessLevelLinesColor = config.wildernessLevelLinesColor(); this.wildernessLevelLinesColor = config.wildernessLevelLinesColor();
this.thinnerLines = config.thinnerLines();
} }
} }

View File

@@ -37,7 +37,8 @@ public interface TileIndicatorsConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "highlightDestinationColor", keyName = "highlightDestinationColor",
name = "Color of current destination highlighting", name = "Color of current destination highlighting",
description = "Configures the highlight color of current destination" description = "Configures the highlight color of current destination",
position = 0
) )
default Color highlightDestinationColor() default Color highlightDestinationColor()
{ {
@@ -47,18 +48,31 @@ public interface TileIndicatorsConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "highlightDestinationTile", keyName = "highlightDestinationTile",
name = "Highlight destination tile", name = "Highlight destination tile",
description = "Highlights tile player is walking to" description = "Highlights tile player is walking to",
position = 1
) )
default boolean highlightDestinationTile() default boolean highlightDestinationTile()
{ {
return true; return true;
} }
@ConfigItem(
keyName = "thinDestinationTile",
name = "Thin destination tile",
description = "Renders the tile border as 1 pixel wide instead of 2",
position = 2
)
default boolean thinDestinationTile()
{
return false;
}
@Alpha @Alpha
@ConfigItem( @ConfigItem(
keyName = "highlightCurrentColor", keyName = "highlightCurrentColor",
name = "Color of current tile highlighting", name = "Color of current tile highlighting",
description = "Configures the highlight color of current tile position" description = "Configures the highlight color of current tile position",
position = 3
) )
default Color highlightCurrentColor() default Color highlightCurrentColor()
{ {
@@ -68,18 +82,31 @@ public interface TileIndicatorsConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "highlightCurrentTile", keyName = "highlightCurrentTile",
name = "Highlight current tile", name = "Highlight current tile",
description = "Highlights tile player is on" description = "Highlights tile player is on",
position = 4
) )
default boolean highlightCurrentTile() default boolean highlightCurrentTile()
{ {
return false; return false;
} }
@ConfigItem(
keyName = "thinCurrentTile",
name = "Thin current tile",
description = "Renders the tile border as 1 pixel wide instead of 2",
position = 5
)
default boolean thinCurrentTile()
{
return false;
}
@Alpha @Alpha
@ConfigItem( @ConfigItem(
keyName = "highlightHoveredColor", keyName = "highlightHoveredColor",
name = "Color of current hovered highlighting", name = "Color of current hovered highlighting",
description = "Configures the highlight color of hovered tile" description = "Configures the highlight color of hovered tile",
position = 6
) )
default Color highlightHoveredColor() default Color highlightHoveredColor()
{ {
@@ -89,10 +116,22 @@ public interface TileIndicatorsConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "highlightHoveredTile", keyName = "highlightHoveredTile",
name = "Highlight hovered tile", name = "Highlight hovered tile",
description = "Highlights tile player is hovering with mouse" description = "Highlights tile player is hovering with mouse",
position = 7
) )
default boolean highlightHoveredTile() default boolean highlightHoveredTile()
{ {
return false; return false;
} }
@ConfigItem(
keyName = "thinHoveredTile",
name = "Thin hovered tile",
description = "Renders the tile border as 1 pixel wide instead of 2",
position = 8
)
default boolean thinHoveredTile()
{
return false;
}
} }

View File

@@ -62,14 +62,28 @@ public class TileIndicatorsOverlay extends Overlay
if (plugin.isHighlightHoveredTile() && if (plugin.isHighlightHoveredTile() &&
// If we have tile "selected" render it // If we have tile "selected" render it
client.getSelectedSceneTile() != null) client.getSelectedSceneTile() != null)
{
if (plugin.isThinHoveredTile())
{
renderTileThin(graphics, client.getSelectedSceneTile().getLocalLocation(), plugin.getHighlightHoveredColor());
}
else
{ {
renderTile(graphics, client.getSelectedSceneTile().getLocalLocation(), plugin.getHighlightHoveredColor()); renderTile(graphics, client.getSelectedSceneTile().getLocalLocation(), plugin.getHighlightHoveredColor());
} }
}
if (plugin.isHighlightDestinationTile()) if (plugin.isHighlightDestinationTile())
{
if (plugin.isThinDestinationTile())
{
renderTileThin(graphics, client.getLocalDestinationLocation(), plugin.getHighlightDestinationColor());
}
else
{ {
renderTile(graphics, client.getLocalDestinationLocation(), plugin.getHighlightDestinationColor()); renderTile(graphics, client.getLocalDestinationLocation(), plugin.getHighlightDestinationColor());
} }
}
if (plugin.isHighlightCurrentTile()) if (plugin.isHighlightCurrentTile())
{ {
@@ -85,8 +99,15 @@ public class TileIndicatorsOverlay extends Overlay
return null; return null;
} }
if (plugin.isThinCurrentTile())
{
renderTileThin(graphics, playerPosLocal, plugin.getHighlightCurrentColor());
}
else
{
renderTile(graphics, playerPosLocal, plugin.getHighlightCurrentColor()); renderTile(graphics, playerPosLocal, plugin.getHighlightCurrentColor());
} }
}
return null; return null;
} }
@@ -107,4 +128,21 @@ public class TileIndicatorsOverlay extends Overlay
OverlayUtil.renderPolygon(graphics, poly, color); OverlayUtil.renderPolygon(graphics, poly, color);
} }
private void renderTileThin(final Graphics2D graphics, final LocalPoint dest, final Color color)
{
if (dest == null)
{
return;
}
final Polygon poly = Perspective.getCanvasTilePoly(client, dest);
if (poly == null)
{
return;
}
OverlayUtil.renderPolygonThin(graphics, poly, color);
}
} }

View File

@@ -63,13 +63,19 @@ public class TileIndicatorsPlugin extends Plugin
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean highlightDestinationTile; private boolean highlightDestinationTile;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean thinDestinationTile;
@Getter(AccessLevel.PACKAGE)
private Color highlightCurrentColor; private Color highlightCurrentColor;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean highlightCurrentTile; private boolean highlightCurrentTile;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean thinCurrentTile;
@Getter(AccessLevel.PACKAGE)
private Color highlightHoveredColor; private Color highlightHoveredColor;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private boolean highlightHoveredTile; private boolean highlightHoveredTile;
@Getter(AccessLevel.PACKAGE)
private boolean thinHoveredTile;
@Provides @Provides
TileIndicatorsConfig provideConfig(ConfigManager configManager) TileIndicatorsConfig provideConfig(ConfigManager configManager)
@@ -108,9 +114,12 @@ public class TileIndicatorsPlugin extends Plugin
{ {
this.highlightDestinationColor = config.highlightDestinationColor(); this.highlightDestinationColor = config.highlightDestinationColor();
this.highlightDestinationTile = config.highlightDestinationTile(); this.highlightDestinationTile = config.highlightDestinationTile();
this.thinDestinationTile = config.thinDestinationTile();
this.highlightCurrentColor = config.highlightCurrentColor(); this.highlightCurrentColor = config.highlightCurrentColor();
this.highlightCurrentTile = config.highlightCurrentTile(); this.highlightCurrentTile = config.highlightCurrentTile();
this.thinCurrentTile = config.thinCurrentTile();
this.highlightHoveredColor = config.highlightHoveredColor(); this.highlightHoveredColor = config.highlightHoveredColor();
this.highlightHoveredTile = config.highlightHoveredTile(); this.highlightHoveredTile = config.highlightHoveredTile();
this.thinHoveredTile = config.thinHoveredTile();
} }
} }

View File

@@ -72,6 +72,17 @@ public class OverlayUtil
graphics.setStroke(originalStroke); graphics.setStroke(originalStroke);
} }
public static void renderPolygonThin(Graphics2D graphics, Polygon poly, Color color)
{
graphics.setColor(color);
final Stroke originalStroke = graphics.getStroke();
graphics.setStroke(new BasicStroke(1));
graphics.drawPolygon(poly);
graphics.setColor(new Color(0, 0, 0, 50));
graphics.fillPolygon(poly);
graphics.setStroke(originalStroke);
}
public static void renderMinimapLocation(Graphics2D graphics, Point mini, Color color) public static void renderMinimapLocation(Graphics2D graphics, Point mini, Color color)
{ {
graphics.setColor(Color.BLACK); graphics.setColor(Color.BLACK);
@@ -291,7 +302,7 @@ public class OverlayUtil
if (textLocation != null) if (textLocation != null)
{ {
renderImageLocation(graphics, textLocation, image); renderImageLocation(graphics, textLocation, image);
textLocation = new Point(textLocation.getX() + xOffset , textLocation.getY()); textLocation = new Point(textLocation.getX() + xOffset, textLocation.getY());
renderTextLocation(graphics, textLocation, text, color); renderTextLocation(graphics, textLocation, text, color);
} }
} }