Add UiText class

This commit is contained in:
Michał Czekański 2020-04-04 00:35:40 +02:00
parent 5e76932a55
commit 8dd2522b16

View File

@ -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)