17 lines
364 B
TypeScript
17 lines
364 B
TypeScript
|
import { useRef } from "react";
|
||
|
|
||
|
export interface GameCanvasProps {
|
||
|
width: number;
|
||
|
height: number;
|
||
|
}
|
||
|
|
||
|
export const GameCanvas = ({ width, height }: GameCanvasProps) => {
|
||
|
const canvasRef = useRef<HTMLCanvasElement>(null);
|
||
|
|
||
|
return (
|
||
|
<div className="centered-game">
|
||
|
<canvas ref={canvasRef} width={width} height={height}></canvas>
|
||
|
</div>
|
||
|
);
|
||
|
};
|