Changement de la manière de charcher les textures #27
|
@ -284,6 +284,8 @@ class Assets:
|
|||
# Chargement des textures
|
||||
self.__textures: dict[str, pygame.Surface] = {}
|
||||
for file in glob.iglob("assets/textures/**/*.png", recursive=True):
|
||||
if file.startswith("assets/textures/animations/"):
|
||||
continue
|
||||
self.__textures[file[16:].replace("\\", "/")] = pygame.image.load(
|
||||
file
|
||||
).convert_alpha(surface)
|
||||
|
@ -301,6 +303,8 @@ class Assets:
|
|||
Retourne:
|
||||
La texture qui correspond au nom *name*.
|
||||
"""
|
||||
if name.startswith("animations/"):
|
||||
return pygame.image.load(f"assets/textures/{name}")
|
||||
return self.__textures.get(name, self.__error_texture)
|
||||
|
||||
def get_texture_size(self, name: str) -> Vec2:
|
||||
|
|
Loading…
Reference in a new issue