Add WidgetItemOverlay
This simplifies the logic required for plugins to draw an overlay over an item.
This commit is contained in:
@@ -29,6 +29,7 @@ import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import net.runelite.api.MainBufferProvider;
|
||||
import net.runelite.api.widgets.WidgetItem;
|
||||
|
||||
/**
|
||||
* Interface of callbacks the injected client uses to send events
|
||||
@@ -79,6 +80,11 @@ public interface Callbacks
|
||||
*/
|
||||
void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y);
|
||||
|
||||
/**
|
||||
* Called before the client will render an item widget.
|
||||
*/
|
||||
void drawItem(int itemId, WidgetItem widgetItem);
|
||||
|
||||
/**
|
||||
* Mouse pressed event. If this event will be consumed it will not be propagated further to client.
|
||||
*
|
||||
|
||||
@@ -25,11 +25,15 @@
|
||||
package net.runelite.api.widgets;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import net.runelite.api.Point;
|
||||
|
||||
/**
|
||||
* An item that is being represented in a {@link Widget}.
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class WidgetItem
|
||||
{
|
||||
private final int id;
|
||||
@@ -37,20 +41,6 @@ public class WidgetItem
|
||||
private final int index;
|
||||
private final Rectangle canvasBounds;
|
||||
|
||||
public WidgetItem(int id, int quantity, int index, Rectangle canvasBounds)
|
||||
{
|
||||
this.id = id;
|
||||
this.quantity = quantity;
|
||||
this.index = index;
|
||||
this.canvasBounds = canvasBounds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "WidgetItem{" + "id=" + id + ", quantity=" + quantity + ", index=" + index + ", canvasBounds=" + canvasBounds + '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ID of the item represented.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user