2022-03-08 14:50:48 +01:00
|
|
|
import pygame
|
|
|
|
|
|
|
|
|
|
|
|
def draw_text(text, color, surface, x, y, text_size=30, is_bold=False):
|
|
|
|
if is_bold:
|
|
|
|
font = pygame.font.Font('resources/fonts/Poppins-SemiBold.ttf', text_size)
|
|
|
|
else:
|
|
|
|
font = pygame.font.Font('resources/fonts/Poppins-Regular.ttf', text_size)
|
2022-03-08 12:11:22 +01:00
|
|
|
textobj = font.render(text, 1, color)
|
|
|
|
textrect = textobj.get_rect()
|
|
|
|
textrect.topleft = (x, y)
|
2022-03-08 14:50:48 +01:00
|
|
|
surface.blit(textobj, textrect)
|