Code/Demos/ComposableHud/ViewElement.cs
using System;
using Goo;
using Sandbox;
using Sandbox.UI;

namespace Sandbox.ComposableHud;

// Glue adapter: lifts any solo view that already exposes the (Tick, Build) shape into a HudElement via method-group references, no per-view adapter class needed. Compass/Keystroke/Radial all share that shape so one delegate adapter composes them with zero edits to their view classes.
sealed class ViewElement : HudElement
{
    public required Func<Scene?, float, bool> OnTick  { get; init; }
    public required Func<Container>           OnBuild { get; init; }

    public override bool Tick( Scene? scene, float dt ) => OnTick( scene, dt );
    public override Container Build() => OnBuild();
}