diff --git a/src/main.ts b/src/main.ts index b6d0c64..aff9b2e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -39,7 +39,9 @@ function update(juego: Juego, dt: number) { function draw(juego: Juego, timestamp: number) { const { width, height } = juego.canvas - juego.ctx.clearRect(0, 0, width, height) + juego.ctx.fillStyle = "white" + juego.ctx.fillRect(0, 0, width, height) + juego.ctx.fillStyle = "black" switch (juego.state.current) { case "welcome": welcome.draw(juego, timestamp) @@ -63,7 +65,10 @@ function resizeCanvas(canvas: HTMLCanvasElement) { async function initJuego() { const canvas = document.querySelector("#juego")! - const ctx = canvas.getContext("2d")! + const ctx = canvas.getContext("2d", { + alpha: false, + desynchronized: true, + })! window.addEventListener("resize", () => resizeCanvas(canvas), false) resizeCanvas(canvas)