diff --git a/src/ui/UiText.py b/src/ui/UiText.py index 2200d35..e3537ef 100644 --- a/src/ui/UiText.py +++ b/src/ui/UiText.py @@ -1,5 +1,17 @@ -import src.ui.UiElement as UiElement +from typing import Tuple + +import pygame + +from src.ui.UiElement import UiElement class UiText(UiElement): - pass + def __init__(self, rect: pygame.Rect, text: str, font: pygame.font.Font = None, + textColor: Tuple[int, int, int] = (0, 0, 0), antialias: bool = False, + backgroundColor: Tuple[int, int, int] = None): + super().__init__(rect) + + if font is None: + font = pygame.font.Font(None, 12) + + self.image = font.render(text, antialias, textColor, backgroundColor)