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' }) }