use of net.runelite.api.Point in project runelite by runelite.
the class OverlayUtil method renderActorOverlay.
public static void renderActorOverlay(Graphics2D graphics, Actor actor, String text, Color color) {
Polygon poly = actor.getCanvasTilePoly();
if (poly != null) {
renderPolygon(graphics, poly, color);
}
Point textLocation = actor.getCanvasTextLocation(graphics, text, actor.getLogicalHeight() + 40);
if (textLocation != null) {
renderTextLocation(graphics, textLocation, text, color);
}
}
use of net.runelite.api.Point in project runelite by runelite.
the class OverlayUtil method renderTileOverlay.
public static void renderTileOverlay(Graphics2D graphics, TileObject tileObject, String text, Color color) {
Polygon poly = tileObject.getCanvasTilePoly();
if (poly != null) {
renderPolygon(graphics, poly, color);
}
Point minimapLocation = tileObject.getMinimapLocation();
if (minimapLocation != null) {
renderMinimapLocation(graphics, minimapLocation, color);
}
Point textLocation = tileObject.getCanvasTextLocation(graphics, text, 0);
if (textLocation != null) {
renderTextLocation(graphics, textLocation, text, color);
}
}
use of net.runelite.api.Point in project runelite by runelite.
the class XpGlobesOverlay method drawTooltipIfMouseover.
private void drawTooltipIfMouseover(Graphics2D graphics, XpGlobe mouseOverSkill, Ellipse2D drawnGlobe) {
Point mouse = client.getMouseCanvasPosition();
int mouseX = mouse.getX();
int mouseY = mouse.getY();
if (!drawnGlobe.contains(mouseX, mouseY)) {
return;
}
// draw tooltip under the globe of the mouse location
int x = (int) drawnGlobe.getX() - (TOOLTIP_RECT_SIZE_X / 2) + (config.xpOrbSize() / 2);
int y = (int) drawnGlobe.getY() + config.xpOrbSize() + 10;
String skillName = mouseOverSkill.getSkillName();
String skillLevel = Integer.toString(mouseOverSkill.getCurrentLevel());
DecimalFormat decimalFormat = new DecimalFormat("###,###,###");
String skillCurrentXp = decimalFormat.format(mouseOverSkill.getCurrentXp());
PanelComponent xpTooltip = new PanelComponent();
xpTooltip.setPosition(new java.awt.Point(x, y));
xpTooltip.setWidth(TOOLTIP_RECT_SIZE_X);
List<PanelComponent.Line> lines = xpTooltip.getLines();
lines.add(new PanelComponent.Line(skillName, Color.WHITE, skillLevel, Color.WHITE));
lines.add(new PanelComponent.Line("Current xp:", Color.ORANGE, skillCurrentXp, Color.WHITE));
if (mouseOverSkill.getGoalXp() != -1) {
String skillXpToLvl = decimalFormat.format(mouseOverSkill.getGoalXp() - mouseOverSkill.getCurrentXp());
lines.add(new PanelComponent.Line("Xp to level:", Color.ORANGE, skillXpToLvl, Color.WHITE));
// Create progress bar for skill.
ProgressBarComponent progressBar = new ProgressBarComponent();
double progress = mouseOverSkill.getSkillProgress(Experience.getXpForLevel(mouseOverSkill.getCurrentLevel()), mouseOverSkill.getCurrentXp(), mouseOverSkill.getGoalXp());
progressBar.setProgress(progress);
xpTooltip.setProgressBar(progressBar);
}
xpTooltip.render(graphics);
}
use of net.runelite.api.Point in project runelite by runelite.
the class AgilityOverlay method render.
@Override
public Dimension render(Graphics2D graphics) {
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
Point mousePosition = client.getMouseCanvasPosition();
plugin.getObstacles().forEach((object, tile) -> {
if (tile.getPlane() == client.getPlane() && object.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE) {
Area objectClickbox = object.getClickbox();
if (objectClickbox != null) {
Color configColor = config.getOverlayColor();
if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY())) {
graphics.setColor(configColor.darker());
} else {
graphics.setColor(configColor);
}
graphics.draw(objectClickbox);
graphics.setColor(new Color(configColor.getRed(), configColor.getGreen(), configColor.getBlue(), 50));
graphics.fill(objectClickbox);
}
}
});
return null;
}
use of net.runelite.api.Point in project runelite by runelite.
the class JarvisTest method test2.
@Test
public void test2() {
Point[] points = { new Point(0, 3), new Point(4, 2), new Point(3, 5), new Point(5, 3), new Point(3, 0), new Point(1, 1), new Point(1, 2), new Point(2, 2) };
List<Point> result = Jarvis.convexHull(Arrays.asList(points));
Assert.assertEquals(5, result.size());
Assert.assertEquals(new Point(0, 3), result.get(0));
Assert.assertEquals(new Point(3, 5), result.get(1));
Assert.assertEquals(new Point(5, 3), result.get(2));
Assert.assertEquals(new Point(3, 0), result.get(3));
Assert.assertEquals(new Point(1, 1), result.get(4));
}
Aggregations