diff --git a/engine/render/text.go b/engine/render/text.go index 471f85e..419c96a 100644 --- a/engine/render/text.go +++ b/engine/render/text.go @@ -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) +}