Game UI: diegetic HUD over persistent vault scene

Space Engine-style viewport with cockpit frame, glyph rail,
console overlays for orbits/wormhole/decay/reconstitute.
This commit is contained in:
Tessera Agent
2026-11-09 10:36:21 +00:00
parent 1a67876f19
commit d358c73291
8 changed files with 481 additions and 128 deletions

View File

@@ -0,0 +1,60 @@
import { motion } from "motion/react";
export type HUDMode = "scene" | "orbits" | "wormhole" | "decay" | "reconstitute";
const items: { id: HUDMode; label: string; glyph: string; hint: string }[] = [
{ id: "scene", label: "Viewport", glyph: "◎", hint: "Vault ring" },
{ id: "orbits", label: "Orbits", glyph: "⟳", hint: "Flight paths" },
{ id: "wormhole", label: "Wormhole", glyph: "◉", hint: "Outpost link" },
{ id: "decay", label: "Decay", glyph: "◇", hint: "Fade policy" },
{ id: "reconstitute", label: "Restore", glyph: "↩", hint: "Reconstitute" },
];
export function HUDRail({
active,
onSelect,
capturing,
}: {
active: HUDMode;
onSelect: (m: HUDMode) => void;
capturing?: boolean;
}) {
return (
<nav
className="pointer-events-auto absolute bottom-6 left-1/2 -translate-x-1/2 z-30 flex gap-1 px-2 py-1.5 rounded-full border border-wormhole-violet/25 bg-space-950/75 backdrop-blur-xl shadow-[0_0_40px_rgba(5,6,15,0.8)]"
aria-label="Ship systems"
>
{items.map((item) => {
const on = active === item.id;
return (
<motion.button
key={item.id}
type="button"
title={item.hint}
onClick={() => onSelect(item.id)}
className={`relative px-3 py-2 rounded-full text-xs font-mono transition-colors ${
on
? "text-wormhole-violet bg-wormhole-violet/15"
: "text-star-400 hover:text-star-200"
}`}
whileTap={{ scale: 0.94 }}
>
<span className="sr-only">{item.label}</span>
<span aria-hidden className="text-sm">
{item.glyph}
</span>
{on && (
<motion.span
layoutId="hud-pip"
className="absolute -bottom-1 left-1/2 w-1 h-1 -translate-x-1/2 rounded-full bg-orbit-green"
/>
)}
{item.id === "orbits" && capturing && (
<span className="absolute -top-0.5 -right-0.5 w-2 h-2 rounded-full bg-orbit-amber animate-pulse" />
)}
</motion.button>
);
})}
</nav>
);
}