Usar drawText en win.ts
This commit is contained in:
parent
97d97508e7
commit
aca00b6bb2
1 changed files with 4 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
||||||
import { Juego } from './main'
|
import { Juego } from './main'
|
||||||
|
import { drawText } from './utils'
|
||||||
|
|
||||||
export type State = {
|
export type State = {
|
||||||
current: "win"
|
current: "win"
|
||||||
|
@ -8,8 +9,7 @@ export function update(juego: Juego<State>, dt: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function draw(juego: Juego<State>, timestamp: number) {
|
export function draw(juego: Juego<State>, timestamp: number) {
|
||||||
juego.ctx.font = `bold 3rem sans-serif`
|
drawText(juego, '¡Salvaste la costanera!',
|
||||||
const winText = '¡Salvaste la costanera!'
|
{ x: juego.canvas.width / 2, y: 100 },
|
||||||
const winTextMeasure = juego.ctx.measureText(winText)
|
{ bold: true, size: 3, align: 'center' })
|
||||||
juego.ctx.fillText(winText, juego.canvas.width / 2 - winTextMeasure.width / 2, 100)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue