use of net.runelite.client.ui.overlay.components.ProgressPie in project runelite by runelite.
the class TrapOverlay method drawTimerOnTrap.
/**
* Draws a timer on a given trap.
*
* @param graphics
* @param trap The trap on which the timer needs to be drawn
* @param fill The fill color of the timer
* @param border The border color of the timer
* @param fillTimeLow The fill color of the timer when it is low
* @param borderTimeLow The border color of the timer when it is low
*/
private void drawTimerOnTrap(Graphics2D graphics, HunterTrap trap, Color fill, Color border, Color fillTimeLow, Color borderTimeLow) {
if (trap.getWorldLocation().getPlane() != client.getPlane()) {
return;
}
LocalPoint localLoc = LocalPoint.fromWorld(client, trap.getWorldLocation());
if (localLoc == null) {
return;
}
net.runelite.api.Point loc = Perspective.worldToCanvas(client, localLoc.getX(), localLoc.getY(), trap.getWorldLocation().getPlane());
double timeLeft = 1 - trap.getTrapTimeRelative();
ProgressPie pie = new ProgressPie();
pie.setFill(timeLeft > TIMER_LOW ? fill : fillTimeLow);
pie.setBorderColor(timeLeft > TIMER_LOW ? border : borderTimeLow);
pie.render(graphics, loc, timeLeft);
}
use of net.runelite.client.ui.overlay.components.ProgressPie in project runelite by runelite.
the class TrapOverlay method drawCircleOnTrap.
/**
* Draws a timer on a given trap.
*
* @param graphics
* @param trap The trap on which the timer needs to be drawn
* @param fill The fill color of the timer
* @param border The border color of the timer
*/
private void drawCircleOnTrap(Graphics2D graphics, HunterTrap trap, Color fill, Color border) {
if (trap.getWorldLocation().getPlane() != client.getPlane()) {
return;
}
LocalPoint localLoc = LocalPoint.fromWorld(client, trap.getWorldLocation());
if (localLoc == null) {
return;
}
net.runelite.api.Point loc = Perspective.worldToCanvas(client, localLoc.getX(), localLoc.getY(), trap.getWorldLocation().getPlane());
ProgressPie pie = new ProgressPie();
pie.setFill(fill);
pie.setBorderColor(border);
pie.render(graphics, loc, 1);
}
Aggregations