Add UiText class
This commit is contained in:
parent
5e76932a55
commit
8dd2522b16
@ -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):
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user