Precàrrega dels fitxers amb dades per al mode demostració

This commit is contained in:
2024-10-20 21:23:04 +02:00
parent b263e0c4be
commit a3a583deb7
6 changed files with 153 additions and 115 deletions

View File

@@ -33,9 +33,9 @@ Resource::Resource()
loadTextures();
loadTextFiles();
loadAnimations();
loadDemoData();
addPalettes();
std::cout << "\n** RESOURCES LOADED" << std::endl;
}
// Destructor
@@ -118,6 +118,12 @@ Animations &Resource::getAnimation(const std::string &name)
throw std::runtime_error("Animación no encontrada: " + name);
}
// Obtiene el fichero con los datos para el modo demostración a partir de un çindice
DemoData &Resource::getDemoData(int index)
{
return demos_.at(index);
}
// Carga los sonidos
void Resource::loadSounds()
{
@@ -223,6 +229,14 @@ void Resource::loadAnimations()
}
}
// Carga los datos para el modo demostración
void Resource::loadDemoData()
{
std::cout << "\n>> DEMO_FILES" << std::endl;
demos_.emplace_back(loadDemoDataFromFile(Asset::get()->get("demo1.bin")));
demos_.emplace_back(loadDemoDataFromFile(Asset::get()->get("demo2.bin")));
}
// Añade paletas a las texturas
void Resource::addPalettes()
{