diff --git a/src/engine/plugins/render.py b/src/engine/plugins/render.py index 7bb01f5..f24cbcf 100644 --- a/src/engine/plugins/render.py +++ b/src/engine/plugins/render.py @@ -4,7 +4,7 @@ Définis un plugin permettant d'afficher des choses a l'écran. from engine import * from engine.math import Vec2 -import pygame, os +import pygame, glob from engine.plugins.pygame import Display @@ -84,10 +84,12 @@ class TextureManager: def __init__(self, display: Display) -> None: self._textures: dict[str, pygame.Surface] = {} - for file in os.listdir("textures"): - self._textures[file] = pygame.image.load(f"textures/{file}").convert( + for file in glob.iglob("textures/**/*.png", recursive=True): + self._textures[file[9:]] = pygame.image.load(file).convert_alpha( display._surface ) + for file in glob.iglob("textures/**/*.jpg", recursive=True): + self._textures[file[9:]] = pygame.image.load(file).convert(display._surface) error_texture = pygame.Surface((256, 256)) error_texture.fill((0, 0, 0)) pygame.draw.rect(error_texture, (255, 0, 255), (0, 0, 128, 128))