Class TextHudPanel
java.lang.Object
dev.myriadclient.api.ui.Panel
dev.myriadclient.api.ui.hud.HudPanel
dev.myriadclient.api.ui.hud.TextHudPanel
A HUD element made of lines of "label value" text. Implement
lines and you get sizing, right-alignment
when placed on the right of the screen, and the standard HudStyle colour options. Text is drawn in Noto Sans
(FontFamily.SANS) at HudPanel.fontSize(Canvas); labels take the style's label colour and values its value colour, a
gradient or rainbow running down the values.
public class PingHud extends TextHudPanel {
public PingHud() { super("Ping", "", HudStyle.Mode.TEXT); }
@Override
protected void lines(Lines out) {
out.add("Ping", ping() + "ms");
}
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classLines of alternating label and value parts. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final HudStyleThe element's colour options (its "Colors" settings group). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTextHudPanel(String title, String icon, HudStyle.Mode defaultMode) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidlines(TextHudPanel.Lines out) Called every frame (twice: to size the element and to draw it): add this frame's lines toout, which starts empty.As wide as the widest line (at least 20 units), as tall as the lines (at least one).voidDraws the panel.Methods inherited from class Panel
attach, bindClient, capturesKeyboard, charTyped, keyPressed, load, mouseClicked, mouseDragged, mouseReleased, mouseScrolled, onClose, onOpen, save, subtitle, tick, titleControls, tooltip, window
-
Field Details
-
style
The element's colour options (its "Colors" settings group).
-
-
Constructor Details
-
TextHudPanel
- Parameters:
title- its name, also its settings group'sicon- a Nerd Font glyph for itdefaultMode- how values are coloured until the player changes it
-
-
Method Details
-
lines
Called every frame (twice: to size the element and to draw it): add this frame's lines toout, which starts empty. UseHudPanel.preview()to show sample values with no world. -
preferredSize
As wide as the widest line (at least 20 units), as tall as the lines (at least one).- Overrides:
preferredSizein classPanel
-
render
Description copied from class:PanelDraws the panel. Called every frame while visible, with the canvas clipped to the content area and translated so (0,0) is its top-left.width/heightis the content area's size in UI units (animating while the window opens or moves). The mouse is in the same coordinates while the pointer is over this window and nothing covers it, and far outside (-10000) otherwise, so hover checks fail. A HUD element drawn in game, or while the HUD is being edited, gets no meaningful mouse position.
-