1
0
Fork 0

feat(render): add DrawTextCenter()

This commit is contained in:
Henrik Hautakoski 2025-09-24 18:31:10 +02:00
parent cd750a5508
commit 346cf350d8

View file

@ -29,3 +29,9 @@ func DrawText(x, y, size int32, text string, col color.RGBA) {
destRect.X += float32(size)
}
}
func DrawTextCenter(x, y, size int32, text string, col color.RGBA) {
l := int32(len(text))
x = x - ((size * l) / 2)
DrawText(x, y, size, text, col)
}