From aca00b6bb26b50734a907d44bd4b3aacb3c7fac2 Mon Sep 17 00:00:00 2001 From: Nulo Date: Wed, 30 Jun 2021 21:21:21 +0000 Subject: [PATCH] Usar drawText en win.ts --- src/win.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/win.ts b/src/win.ts index 057942a..c01ce1a 100644 --- a/src/win.ts +++ b/src/win.ts @@ -1,4 +1,5 @@ import { Juego } from './main' +import { drawText } from './utils' export type State = { current: "win" @@ -8,8 +9,7 @@ export function update(juego: Juego, dt: number) { } export function draw(juego: Juego, timestamp: number) { - juego.ctx.font = `bold 3rem sans-serif` - const winText = '¡Salvaste la costanera!' - const winTextMeasure = juego.ctx.measureText(winText) - juego.ctx.fillText(winText, juego.canvas.width / 2 - winTextMeasure.width / 2, 100) + drawText(juego, '¡Salvaste la costanera!', + { x: juego.canvas.width / 2, y: 100 }, + { bold: true, size: 3, align: 'center' }) }