For the complete documentation index, see llms.txt. This page is also available as Markdown.

HUD Scripting

HUD scripts let you render custom 2D overlays on screen using the hudManager and hudRenderer namespaces. Elements are draggable in the HUD editor and their positions persist to config automatically.


Render Pipeline

Each frame breeze renders scripted HUD elements in two passes:

  1. Background pass โ€” your onBackground callback returns a list of RoundedRect shapes. These are collected alongside all other HUD backgrounds and rendered together (with blur/shadow) before any content is drawn.

  2. Render pass โ€” your onRender callback runs. Use hudRenderer functions here to draw text, shapes, and items.

All drawing in both passes uses screen-space coordinates with the origin at the top-left corner (x right, y down). The hudManager.x() / hudManager.y() values give you the top-left corner of your element's current dragged position โ€” offset everything you draw from those values.


hudManager

Registers callbacks and exposes layout information for your element.

Callbacks

All callbacks must be registered during script initialization.

// Called every frame to draw your element's content.
// x, y, scale are passed in directly so you don't need to call hudManager.x() etc. inside the callback.
hudManager.onRender((x, y, scale) => {
    // use hudRenderer here
});

// Returns an array of RoundedRect shapes drawn as the blurred background.
hudManager.onBackground(() => {
    return [new RoundedRect(hudManager.x(), hudManager.y(), width, height, 4 * hudManager.scale())];
});

// Returns the pixel width of your element. Used by the HUD editor for snapping.
hudManager.onWidth(() => 160);

// Returns the pixel height of your element.
hudManager.onHeight(() => 40);

Position & Layout

Function
Returns
Description

hudManager.x()

number

Left edge of the element on screen

hudManager.y()

number

Top edge of the element on screen

hudManager.scale()

number

User-configured HUD scale (use this to scale padding, radii, and sizes)

hudManager.fontHeight()

number

Pixel height of the selected HUD font

hudManager.x(), hudManager.y(), and hudManager.scale() are also passed directly into onRender as (x, y, scale) โ€” you only need to call these getters explicitly in onBackground, onWidth, or onHeight.


hudRenderer

All drawing functions take absolute screen coordinates. Inside onRender use the x and y parameters passed to you; in other contexts call hudManager.x() / hudManager.y().

Text

Rectangles

Circles

Items


RoundedRect

Used exclusively in onBackground to describe the blurred background region.


Minimal Example


Tips

  • Scale everything โ€” multiply all padding, corner radii, and icon sizes by hudManager.scale() so the element looks right at any user scale.

  • Guard nulls โ€” mc.player and mc.world can be null (e.g. on the main menu). Check before accessing them.

  • Background vs content โ€” only use onBackground for the blurred rect outline. Decorations and text go in onRender.

  • Dynamic size โ€” onWidth / onHeight are called every frame, so you can return a value based on current content.


See Also

Last updated