Rework the HUD editor

HUDs are drawn as they are in game, background included, through the
new HudModPreview.draw, and the world behind the editor isn't blurred.
Each has an outline that turns the accent color with the mod's name while
hovered or dragged, and a visible resize handle that's easier to grab.
Scale stays within its range and HUDs stay on screen, and a hint says how
to use the editor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-09-27 19:09:06 +02:00
co-authored by claude
parent f0971ff128
commit 25d288da92
2 changed files with 141 additions and 57 deletions
@@ -15,13 +15,21 @@ public class HudModPreview extends Element {
@Override
public void render(RenderScope scope, ElementContext ctx) {
ModLayout layout = feature.getDimensions();
draw(scope, feature);
}
/**
* Draws a HUD mod with sample content and the background it has in game,
* at the origin and its layout's unscaled size.
*/
public static void draw(RenderScope scope, HudMod mod) {
ModLayout layout = mod.getDimensions();
if (layout.renderBackground) {
scope.drawRoundedRectangle(0, 0, layout.width, layout.height,
layout.radius.value, layout.bgColor.value);
}
feature.renderDummy(scope);
mod.renderDummy(scope);
}
}