import pygame


class Text:

    def __init__(self, text, font_size=24, color=(255, 255, 255)):
        self.text = text
        self.police = pygame.font.Font(None, font_size)
        self.surface = self.police.render(text, True, color)
        self.rect = self.surface.get_rect()

    def set_color(self, color):
        self.surface = self.police.render(self.text, True, color)
        return self

    def at(self, x, y):
        self.rect = self.surface.get_rect(x=x, y=y)
        return self

    def set_position(self, **kwargs):
        self.rect = self.surface.get_rect(**kwargs)
        return self

    def show(self, surface: pygame.Surface):
        surface.blit(self.surface, self.rect)


class Title(Text):

    def __init__(self, text='Elironwars'):
        super().__init__(text, font_size=128)
