From f66be06f005b6bc89d21ba499caa644467b4b0a4 Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Mon, 6 Feb 2023 18:18:48 +0100 Subject: [PATCH] refactoring: --- src/main/java/Snake/TextView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/Snake/TextView.java b/src/main/java/Snake/TextView.java index 4fd6078..e68bacf 100644 --- a/src/main/java/Snake/TextView.java +++ b/src/main/java/Snake/TextView.java @@ -50,10 +50,10 @@ public class TextView implements Drawable { FontMetrics fontMetrics = g.getFontMetrics(); int x = position.x; - int y = position.y + fontMetrics.getHeight(); + int y = position.y + fontMetrics.getHeight() / 2; if (anchor == AnchorType.Center) - x -= fontMetrics.stringWidth(text); + x -= fontMetrics.stringWidth(text) / 2; else if (anchor == AnchorType.Right) x -= fontMetrics.stringWidth(text);