aboutsummaryrefslogtreecommitdiff
path: root/go/ui/button.go
diff options
context:
space:
mode:
Diffstat (limited to 'go/ui/button.go')
-rw-r--r--go/ui/button.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/go/ui/button.go b/go/ui/button.go
index 6454ccac..0fd26936 100644
--- a/go/ui/button.go
+++ b/go/ui/button.go
@@ -35,15 +35,8 @@ func (b *SimpleButton) render() *ebiten.Image {
ebitenutil.DrawRect(img, float64(0), float64(0), float64(b.Width), float64(b.Height), b.BG)
bounds := text.BoundString(font.Font24, b.label)
- x := (b.Width - bounds.Dx()) / 2
- if x < 0 {
- x = 0
- }
-
- y := b.Height - bounds.Dy()/2
- if y < 0 {
- y = 0
- }
+ x := b.Width/2 - centerTextXOffset(bounds)
+ y := b.Height/2 - centerTextYOffset(bounds)
text.Draw(img, b.label, font.Font24, x, y, b.FG)
return img
}