use of net.runelite.api.Point in project runelite by runelite.
the class CannonOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
if (!plugin.isCannonPlaced() || plugin.getCannonPosition() == null) {
return null;
}
LocalPoint cannonPoint = LocalPoint.fromWorld(client, plugin.getCannonPosition());
if (cannonPoint == null) {
return null;
}
LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
if (localLocation.distanceTo(cannonPoint) <= MAX_DISTANCE) {
Point cannonLoc = Perspective.getCanvasTextLocation(client, graphics, cannonPoint, String.valueOf(plugin.getCballsLeft()), 200);
if (cannonLoc != null) {
textComponent.setText(String.valueOf(plugin.getCballsLeft()));
textComponent.setPosition(new java.awt.Point(cannonLoc.getX(), cannonLoc.getY()));
textComponent.setColor(plugin.getStateColor());
textComponent.render(graphics);
}
if (config.showDoubleHitSpot()) {
Color color = config.highlightDoubleHitColor();
drawDoubleHitSpots(graphics, cannonPoint, color);
}
}
return null;
}
use of net.runelite.api.Point in project runelite by runelite.
the class ConveyorBeltOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
if (!config.showConveyorBelt() || plugin.getConveyorBelt() == null) {
return null;
}
LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
Point mousePosition = client.getMouseCanvasPosition();
GameObject object = plugin.getConveyorBelt();
LocalPoint location = object.getLocalLocation();
if (localLocation.distanceTo(location) <= MAX_DISTANCE) {
Area objectClickbox = object.getClickbox();
if (objectClickbox != null) {
if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY())) {
graphics.setColor(Color.RED.darker());
} else {
graphics.setColor(Color.RED);
}
graphics.draw(objectClickbox);
graphics.setColor(new Color(0xFF, 0, 0, 20));
graphics.fill(objectClickbox);
}
}
return null;
}
use of net.runelite.api.Point in project runelite by runelite.
the class AbyssOverlay method renderRifts.
private void renderRifts(Graphics2D graphics, DecorativeObject object) {
AbyssRifts rift = AbyssRifts.getRift(object.getId());
if (rift == null || !rifts.contains(rift)) {
return;
}
if (config.showClickBox()) {
// Draw clickbox
Point mousePosition = client.getMouseCanvasPosition();
Area objectClickbox = object.getClickbox();
if (objectClickbox != null) {
if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY())) {
graphics.setColor(Color.MAGENTA.darker());
} else {
graphics.setColor(Color.MAGENTA);
}
graphics.draw(objectClickbox);
graphics.setColor(new Color(255, 0, 255, 20));
graphics.fill(objectClickbox);
}
}
// Draw minimap
BufferedImage image = getImage(rift);
Point miniMapImage = Perspective.getMiniMapImageLocation(client, object.getLocalLocation(), image);
if (miniMapImage != null) {
graphics.drawImage(image, miniMapImage.getX(), miniMapImage.getY(), null);
}
}
use of net.runelite.api.Point in project runelite by runelite.
the class OverlayUtil method renderTextLocation.
public static void renderTextLocation(Graphics2D graphics, Point txtLoc, String text, Color color) {
int x = txtLoc.getX();
int y = txtLoc.getY();
graphics.setColor(Color.BLACK);
graphics.drawString(text, x + 1, y + 1);
graphics.setColor(color);
graphics.drawString(text, x, y);
}
use of net.runelite.api.Point in project runelite by runelite.
the class OverlayUtil method renderActorOverlayImage.
public static void renderActorOverlayImage(Graphics2D graphics, Actor actor, BufferedImage image, Color color, int zOffset) {
Polygon poly = actor.getCanvasTilePoly();
if (poly != null) {
renderPolygon(graphics, poly, color);
}
Point imageLocation = actor.getCanvasImageLocation(graphics, image, zOffset);
if (imageLocation != null) {
renderImageLocation(graphics, imageLocation, image);
}
}
Aggregations