feat(render): add DrawTextCenter()
This commit is contained in:
parent
cd750a5508
commit
346cf350d8
1 changed files with 6 additions and 0 deletions
|
|
@ -29,3 +29,9 @@ func DrawText(x, y, size int32, text string, col color.RGBA) {
|
||||||
destRect.X += float32(size)
|
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)
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue