diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-02 06:00:47 -0700 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-03-02 06:07:42 -0700 |
commit | 4233aca561b5650924f3cc4232cfd294d706c863 (patch) | |
tree | af67bae5565cf1b7d5400d9678d1fcc038584438 /src/components/GameCanvas.tsx | |
parent | cbb88091bdf69cc8752ef1cc3662dc0b99e3ead6 (diff) | |
download | the-abstraction-engine-4233aca561b5650924f3cc4232cfd294d706c863.tar.gz the-abstraction-engine-4233aca561b5650924f3cc4232cfd294d706c863.zip |
refocus canvas on lambda factory clsoe
Diffstat (limited to 'src/components/GameCanvas.tsx')
-rw-r--r-- | src/components/GameCanvas.tsx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/components/GameCanvas.tsx b/src/components/GameCanvas.tsx index 0ea7180..09351e3 100644 --- a/src/components/GameCanvas.tsx +++ b/src/components/GameCanvas.tsx @@ -1,5 +1,6 @@ import { useState, useEffect, useRef } from "react"; import { TheAbstractionEngine, Game } from "../engine"; +import { Miscellaneous } from "../engine/config"; export interface GameCanvasProps { width: number; @@ -21,6 +22,8 @@ export const GameCanvas = ({ width, height }: GameCanvasProps) => { theAbstractionEngine.init().then(() => { theAbstractionEngine.play(); setGame(theAbstractionEngine); + + canvas.focus(); }); return () => theAbstractionEngine.stop(); @@ -30,7 +33,13 @@ export const GameCanvas = ({ width, height }: GameCanvasProps) => { return ( <div className="centered-game"> - <canvas ref={canvasRef} width={width} height={height}></canvas> + <canvas + id={Miscellaneous.CANVAS_ID} + tabIndex={1} + ref={canvasRef} + width={width} + height={height} + ></canvas> </div> ); }; |