Class PrivBotOverlays
java.lang.Object
privbot.ui.overlay.PrivBotOverlays
Entry point of the overlay kit: describe a HUD panel or a scene overlay, then install the set.
private final Snapshot<HudState> hud = Snapshot.empty(); // published on the game tick
Overlay panel = PrivBotOverlays.panel("Scurrius")
.visibleWhen(this::isEnabled)
.rows(hud, (r, s) -> {
r.status("State", s.segment, s.inCombat ? OverlayTheme.GOOD : OverlayTheme.MUTED);
r.fraction("HP", s.hp, s.maxHp, ColorRamp.percentBelow(config.eatHpThreshold()));
r.runtime("Runtime", s.startedAt);
});
Overlay tiles = PrivBotOverlays.scene(client)
.draw(hazards, (c, s) -> s.forEach(h -> c.countdown(h.tile, h.ticksLeft, ColorRamp.ticks(1, 2))));
overlays = PrivBotOverlays.install(overlayManager, panel, tiles); // startUp
overlays.close(); // shutDown
Composers run on the render thread and receive the published state and nothing else; that is what keeps them safe on Impact, where a client hook from the render thread times out.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDescribes a HUD panel;PrivBotOverlays.PanelBuilder.rows(java.util.function.Supplier<S>, java.util.function.BiConsumer<privbot.ui.overlay.Rows, S>)is the terminal step.static final classDescribes a scene overlay;PrivBotOverlays.SceneBuilder.draw(java.util.function.Supplier<S>, java.util.function.BiConsumer<privbot.ui.overlay.SceneCanvas, S>)is the terminal step. -
Method Summary
Modifier and TypeMethodDescriptionstatic OverlaySetinstall(net.runelite.client.ui.overlay.OverlayManager manager, boolean visible, net.runelite.client.ui.overlay.Overlay... overlays) install(OverlayManager, Overlay...), registering the overlays only whenvisible.static OverlaySetinstall(net.runelite.client.ui.overlay.OverlayManager manager, net.runelite.client.ui.overlay.Overlay... overlays) Registeroverlaysnow and return the handle to hide or remove them later.static PrivBotOverlays.PanelBuilderStarts a HUD panel titledtitle(top-left, above widgets,OverlayTheme.PANEL_WIDTHwide).static PrivBotOverlays.SceneBuilderscene(net.runelite.api.Client client) Starts a scene overlay that projects throughSceneProjection.of(Client).static PrivBotOverlays.SceneBuilderscene(SceneProjection projection) Starts a scene overlay with an explicit projection (tests, or a projection you already hold).
-
Method Details
-
panel
Starts a HUD panel titledtitle(top-left, above widgets,OverlayTheme.PANEL_WIDTHwide). -
scene
Starts a scene overlay that projects throughSceneProjection.of(Client). -
scene
Starts a scene overlay with an explicit projection (tests, or a projection you already hold). -
install
public static OverlaySet install(net.runelite.client.ui.overlay.OverlayManager manager, net.runelite.client.ui.overlay.Overlay... overlays) Registeroverlaysnow and return the handle to hide or remove them later. -
install
public static OverlaySet install(net.runelite.client.ui.overlay.OverlayManager manager, boolean visible, net.runelite.client.ui.overlay.Overlay... overlays) install(OverlayManager, Overlay...), registering the overlays only whenvisible.
-