import {useComputed} from '@preact/signals'; import { createGameHost } from 'boardgame-core'; import Phaser from 'phaser'; import { h } from 'preact'; import { PhaserGame, PhaserScene } from 'boardgame-phaser'; export default function App(props: { gameModule: any, gameScene: { new(): Phaser.Scene } }) { const gameHost = useComputed(() => { const gameHost = createGameHost(props.gameModule); return { gameHost }; }); const scene = useComputed(() => new props.gameScene()); const handleReset = () => { gameHost.value.gameHost.start(); }; const label = useComputed(() => gameHost.value.gameHost.status.value === 'running' ? 'Restart' : 'Start'); const phaserConfig: Partial = { width: 800, height: 700, }; return (
); }