Merge pull request #842 from f0rmatme/grid

inventorygrid: add color configuration
This commit is contained in:
Tyler Bochard
2019-07-02 03:09:48 -04:00
committed by GitHub
2 changed files with 36 additions and 10 deletions

View File

@@ -24,6 +24,8 @@
*/
package net.runelite.client.plugins.inventorygrid;
import java.awt.Color;
import net.runelite.client.config.Alpha;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@@ -35,7 +37,8 @@ public interface InventoryGridConfig extends Config
@ConfigItem(
keyName = "showItem",
name = "Show item",
description = "Show a preview of the item in the new slot"
description = "Show a preview of the item in the new slot",
position = 1
)
default boolean showItem()
{
@@ -45,7 +48,8 @@ public interface InventoryGridConfig extends Config
@ConfigItem(
keyName = "showGrid",
name = "Show grid",
description = "Show a grid on the inventory while dragging"
description = "Show a grid on the inventory while dragging",
position = 2
)
default boolean showGrid()
{
@@ -55,7 +59,8 @@ public interface InventoryGridConfig extends Config
@ConfigItem(
keyName = "showHighlight",
name = "Highlight background",
description = "Show a green background highlight on the new slot"
description = "Show a background highlight on the new slot",
position = 3
)
default boolean showHighlight()
{
@@ -65,11 +70,36 @@ public interface InventoryGridConfig extends Config
@ConfigItem(
keyName = "dragDelay",
name = "Drag Delay",
description = "Time in ms to wait after item press before showing grid"
description = "Time in ms to wait after item press before showing grid",
position = 4
)
@Range(min = 100)
default int dragDelay()
{
return 100;
}
@Alpha
@ConfigItem(
keyName = "gridColor",
name = "Grid color",
description = "The color of the grid",
position = 5
)
default Color gridColor()
{
return new Color(255, 255, 255, 45);
}
@Alpha
@ConfigItem(
keyName = "highlightColor",
name = "Highlight color",
description = "The color of the new inventory slot highlight",
position = 6
)
default Color highlightColor()
{
return new Color(0, 255, 0, 45);
}
}

View File

@@ -27,7 +27,6 @@ package net.runelite.client.plugins.inventorygrid;
import com.google.inject.Inject;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
@@ -47,9 +46,6 @@ class InventoryGridOverlay extends Overlay
{
private static final int INVENTORY_SIZE = 28;
private static final Color HIGHLIGHT = new Color(0, 255, 0, 45);
private static final Color GRID = new Color(255, 255, 255, 45);
private final InventoryGridConfig config;
private final Client client;
private final ItemManager itemManager;
@@ -101,12 +97,12 @@ class InventoryGridOverlay extends Overlay
if (config.showHighlight() && inBounds)
{
graphics.setColor(HIGHLIGHT);
graphics.setColor(config.highlightColor());
graphics.fill(bounds);
}
else if (config.showGrid())
{
graphics.setColor(GRID);
graphics.setColor(config.gridColor());
graphics.fill(bounds);
}
}