Reference
HudPreview
A live sample of what a module looks like, drawn in the settings screen's PREVIEW card while its page is open.
Members
int width()since 1.2.0Width in screen pixels, the same units as HudModule.getWidth(), with scale already applied.
int height()since 1.2.0Height in screen pixels.
void render(GuiGraphicsExtractor ctx, float tickDelta)since 1.2.0Draws the preview with its top-left corner at 0, 0. Called once a frame while the page is open, so keep it as cheap as the real render path. Throwing loses the preview for that frame, not the screen.
static HudPreview ofModule(HudModule module)since 1.2.0A preview that is simply the module drawing itself, which is what every built-in module uses. The size comes from getWidth() and getHeight() and the drawing from extractRenderState, all under isPreviewing(). The module's render position is moved to the origin for the call and put back afterwards, because the editor hit-tests against it.
Who owns the geometry
The host measures you, sizes the card, centers you, applies the transform that makes one of your pixels one real screen pixel, and clips you to the card. So render draws from the origin in plain screen pixels and never translates or scales itself.
Anything wider than the card is clipped rather than shrunk, because the point is seeing the module at the size it will really be. The card's FOCUS button is the way to see a module too big to fit.
Keep preview animation state apart. The preview is drawn on top of a running HUD whenever the settings screen is open in game, so a per-frame counter stepped by both runs at double speed. Keep a preview-local copy, or leave it alone while isPreviewing().