Arreglado un bug en el cambio de paleta durante el juego

This commit is contained in:
2022-10-27 19:24:41 +02:00
parent 1934f790f7
commit c1f0f90b16
6 changed files with 46 additions and 13 deletions

View File

@@ -27,8 +27,8 @@ void Resource::loadAnimations(std::vector<std::string> list)
for (auto l : list)
{
animation_t as;
as.name = l+".ani";
as.animation = new animatedSprite_t(loadAnimationFromFile(getTexture(l+".png"), asset->get(l+".ani")));
as.name = l + ".ani";
as.animation = new animatedSprite_t(loadAnimationFromFile(getTexture(l + ".png"), asset->get(l + ".ani")));
animations.push_back(as);
}
}
@@ -52,6 +52,23 @@ void Resource::freeTextures()
textures.clear();
}
// Libera las animaciones
void Resource::freeAnimations()
{
for (auto a : animations)
{
delete a.animation;
}
animations.clear();
}
// Libera todos los recursos
void Resource::free()
{
freeTextures();
freeAnimations();
}
// Obtiene una textura
Texture *Resource::getTexture(std::string name)
{