Trabajando en la carga de recursos por nombre

This commit is contained in:
2022-10-31 18:37:48 +01:00
parent deb820015f
commit a354104c8c
10 changed files with 227 additions and 179 deletions

View File

@@ -26,9 +26,13 @@ void Resource::loadAnimations(std::vector<std::string> list)
{
for (auto l : list)
{
// Extrae el nombre del fichero sin la extension para crear el nombre del fichero de la textura
const size_t lastIndex = l.find_last_of(".");
const std:: string pngFile = l.substr(0, lastIndex)+".png";
res_animation_t as;
as.name = l + ".ani";
as.animation = new animatedSprite_t(loadAnimationFromFile(getTexture(l + ".png"), asset->get(l + ".ani")));
as.name = l;
as.animation = new animatedSprite_t(loadAnimationFromFile(getTexture(pngFile), asset->get(l)));
animations.push_back(as);
}
}