import pygame
from loja import Loja

def parede_invisivel(x, y, largura, altura):
    rect = pygame.Rect(x, y, largura, altura)
    return rect

def fadeout(window):
    fade = pygame.Surface((window.get_width(), window.get_height()))
    fade.fill((0, 0, 0))
    for i in range(0, 255):
        fade.set_alpha(i)
        window.blit(fade, (0, 0))
        pygame.display.update()
        pygame.time.delay(5)

def poploja(window, tela, player):
    loja = Loja(window, player)
    roda = True
    while roda:
        retorna = loja.update()
        tela.desenha()
        loja.draw()

        if retorna == 'sair' or retorna == 'volta':
            roda = False
    return retorna

def verifica_input(input):
    valido = True
    for letra in input:
        if not letra.isalpha() and not letra.isnumeric():
            valido =  False
    return valido