import pygame

class Label:
    rect:pygame.rect
    image:pygame.image
    __screen:pygame.surface
    __text:str
    __pos:pygame.Vector2
    __font:pygame.font
    font:pygame.font
    __name:str

    def __init__(self, name:str, screen:pygame.surface, text:str, pos:pygame.Vector2, size:float=20, color:str="white"):
        self.__font = pygame.font.SysFont("Arial", size)
        self.font = pygame.font.SysFont("Arial", size)
        self.image = self.font.render(text, 1, color)
        _, _, w, h = self.image.get_rect()
        self.__pos = pos
        self.rect = pygame.Rect(self.__pos.x, self.__pos.y, w, h)
        self.__screen = screen
        self.__text = text

    def getText(self) -> str:
        return self.__text

    def getFont(self) -> pygame.font:
        return self.__font

    def getPos(self) -> pygame.Vector2:
        return self.__pos

    def getName(self) -> str:
        return self.__name

    def setText(self, newtext:str, color:str="white"):
        self.image = self.font.render(newtext, 1, color)

    def setFont(self, font:pygame.font, size:float, color:str="white"):
        self.__font = pygame.font.SysFont(font, size)
        self.change_text(self.text, color)

    def setPos(self, pos:pygame.Vector2):
        self.__pos = pos

    def draw(self):
        self.__screen.blit(self.image, (self.rect))