From 71693518a81710e0c0fc9644b733be27120dea63 Mon Sep 17 00:00:00 2001 From: Brosef Date: Thu, 26 Jun 2025 07:21:57 +0100 Subject: [PATCH] Added text margins --- game.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/game.py b/game.py index d5b340e..89ad41f 100644 --- a/game.py +++ b/game.py @@ -71,6 +71,9 @@ class Game(gameUtils.Game): font = pygame.font.SysFont('', 32) items = [f'Example item {i+1}' for i in range(17)] + # How many pixels away from the outer side of the + # circle the text should be + textMargin = 5 # Calculate circle radius circleR = self.wheelSurf.size[0] / 2 @@ -94,7 +97,7 @@ class Game(gameUtils.Game): # Render the item text text = font.render(item, True, (255, 255, 255)) # Draw the item text onto the text surface, centred to the right - textSurf.blit(text, (textSurf.size[0]-text.get_width(), self.size[1]//2 - text.get_height()//2)) + textSurf.blit(text, (textSurf.size[0]-text.get_width()-textMargin, self.size[1]//2 - text.get_height()//2)) # Draw debug lines #pygame.draw.rect(textSurf, (0, 128, 255), (0, 0, textSurf.size[0], textSurf.size[1]), 1) #pygame.draw.line(textSurf, (255, 0, 0), (circleR, circleR), (textSurf.size[0], circleR))