Added text margins
This commit is contained in:
5
game.py
5
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))
|
||||
|
||||
Reference in New Issue
Block a user