Replace mobile touch overlay with a coin-door-styled bottom control bar
The engine's default attachTouchControls() overlay was generic floating circles; this swaps in an app-themed bottom bar (left/right flipper, plunger, insert coin, start game) anchored to the screen edges instead.
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
import { useRef } from "react";
|
||||
import { usePinballInstance, type RomSelection } from "@/lib/pinball/usePinballInstance";
|
||||
import { useTouchControls } from "@/lib/pinball/useTouchControls";
|
||||
import CoinDoorHud from "@/components/hud/CoinDoorHud";
|
||||
import TouchControlBar from "@/components/hud/TouchControlBar";
|
||||
import type { TableInfo } from "@/lib/pinball/types";
|
||||
|
||||
export interface PinballCanvasImplProps {
|
||||
@@ -14,16 +14,14 @@ export interface PinballCanvasImplProps {
|
||||
|
||||
export default function PinballCanvasImpl({ tableData, rom, tableInfo }: PinballCanvasImplProps) {
|
||||
const canvasRef = useRef<HTMLCanvasElement | null>(null);
|
||||
const containerRef = useRef<HTMLDivElement | null>(null);
|
||||
const { status, progress, error, loadTimeMs, instanceRef, start } = usePinballInstance(
|
||||
canvasRef,
|
||||
tableData,
|
||||
rom,
|
||||
);
|
||||
useTouchControls(containerRef, status === "running");
|
||||
|
||||
return (
|
||||
<div ref={containerRef} className="relative h-full w-full overflow-hidden bg-black">
|
||||
<div className="relative h-full w-full overflow-hidden bg-black">
|
||||
{/* SDL3's Emscripten backend resolves its own window/GL-context target via
|
||||
document.querySelector("#canvas") independently of Module.canvas — the
|
||||
id is required or context creation silently no-ops (findCanvasEventTarget
|
||||
@@ -35,6 +33,8 @@ export default function PinballCanvasImpl({ tableData, rom, tableInfo }: Pinball
|
||||
<CoinDoorHud instanceRef={instanceRef} tableInfo={tableInfo} loadTimeMs={loadTimeMs} />
|
||||
)}
|
||||
|
||||
<TouchControlBar active={status === "running"} />
|
||||
|
||||
{status === "loading" && (
|
||||
<div className="absolute inset-0 flex flex-col items-center justify-center gap-4 bg-ink/90 text-paper">
|
||||
<div className="font-display text-2xl tracking-wide text-marquee">LOADING TABLE</div>
|
||||
|
||||
Reference in New Issue
Block a user