My Pygame Game Engine
at main 495 B view raw
1## Imports 2 3import pygame, os 4pygame.font.init() 5 6## Class 7 8class font_handler: 9 def __init__(self, game) -> None: 10 self.game = game 11 12 ## Returns a render of the designated font and text using the designated font from the current assetpack 13 14 def render(self, text, font, size, color): 15 font_file = pygame.font.Font(os.path.join('src', 'resources', self.game.current_assetpack, 'assets', 'fonts', font + '.ttf'), size) 16 return font_file.render(text, True, color) 17 18