Chargement des texture dans les sous dossiers #15
|
@ -85,11 +85,11 @@ class TextureManager:
|
||||||
def __init__(self, display: Display) -> None:
|
def __init__(self, display: Display) -> None:
|
||||||
self._textures: dict[str, pygame.Surface] = {}
|
self._textures: dict[str, pygame.Surface] = {}
|
||||||
for file in glob.iglob("textures/**/*.png", recursive=True):
|
for file in glob.iglob("textures/**/*.png", recursive=True):
|
||||||
self._textures[file] = pygame.image.load(file).convert_alpha(
|
self._textures[file[9:]] = pygame.image.load(file).convert_alpha(
|
||||||
display._surface
|
display._surface
|
||||||
)
|
)
|
||||||
for file in glob.iglob("textures/**/*.jpg", recursive=True):
|
for file in glob.iglob("textures/**/*.jpg", recursive=True):
|
||||||
self._textures[file] = pygame.image.load(file).convert(display._surface)
|
self._textures[file[9:]] = pygame.image.load(file).convert(display._surface)
|
||||||
error_texture = pygame.Surface((256, 256))
|
error_texture = pygame.Surface((256, 256))
|
||||||
error_texture.fill((0, 0, 0))
|
error_texture.fill((0, 0, 0))
|
||||||
pygame.draw.rect(error_texture, (255, 0, 255), (0, 0, 128, 128))
|
pygame.draw.rect(error_texture, (255, 0, 255), (0, 0, 128, 128))
|
||||||
|
|
Loading…
Reference in a new issue