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:
60
web/src/components/hud/HUDRail.tsx
Normal file
60
web/src/components/hud/HUDRail.tsx
Normal 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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user