Files
common/src/main/java/org/saturnclient/ui/components/HudModPreview.java
T
selimaj-devandclaude 25d288da92 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]>
2026-09-27 19:09:06 +02:00

36 lines
984 B
Java

package org.saturnclient.ui.components;
import org.saturnclient.mod.HudMod;
import org.saturnclient.mod.ModLayout;
import org.saturnclient.ui.Element;
import org.saturnclient.ui.ElementContext;
import org.saturnclient.ui.RenderScope;
public class HudModPreview extends Element {
HudMod feature;
public HudModPreview(HudMod feature) {
this.feature = feature;
}
@Override
public void render(RenderScope scope, ElementContext ctx) {
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);
}
mod.renderDummy(scope);
}
}