diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-02 01:07:55 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-02 01:07:55 -0700 |
commit | 1ec5a8d088f599d094f387abc6014f228607b605 (patch) | |
tree | 0d0e0271b6d5db354a56337c5de9df1a933e767b /src/components/GameCanvas.tsx | |
parent | a333ce8845de4269d6a6f5523d2273da11fe271c (diff) | |
download | the-abstraction-engine-1ec5a8d088f599d094f387abc6014f228607b605.tar.gz the-abstraction-engine-1ec5a8d088f599d094f387abc6014f228607b605.zip |
add interactable component
Diffstat (limited to 'src/components/GameCanvas.tsx')
-rw-r--r-- | src/components/GameCanvas.tsx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/components/GameCanvas.tsx b/src/components/GameCanvas.tsx index 5cb40a6..0ea7180 100644 --- a/src/components/GameCanvas.tsx +++ b/src/components/GameCanvas.tsx @@ -8,10 +8,10 @@ export interface GameCanvasProps { export const GameCanvas = ({ width, height }: GameCanvasProps) => { const canvasRef = useRef<HTMLCanvasElement>(null); - const [_game, setGame] = useState<TheAbstractionEngine>(); + const [game, setGame] = useState<TheAbstractionEngine>(); useEffect(() => { - if (canvasRef.current) { + if (canvasRef.current && !game) { const canvas = canvasRef.current; const ctx = canvas.getContext("2d"); if (ctx) { |