Els objectes de Text es precarreguen al inici

This commit is contained in:
2024-11-04 19:08:18 +01:00
parent e0e82ee273
commit 30735f00e8
16 changed files with 80 additions and 30 deletions

View File

@@ -54,6 +54,17 @@ struct ResourceTextFile
: name(name), text_file(text_file) {}
};
// Estructura para almacenar objetos Text y su nombre
struct ResourceText
{
std::string name; // Nombre del objeto
std::shared_ptr<Text> text; // Objeto
// Constructor
ResourceText(const std::string &name, std::shared_ptr<Text> text)
: name(name), text(text) {}
};
// Estructura para almacenar ficheros animaciones y su nombre
struct ResourceAnimation
{
@@ -75,6 +86,7 @@ private:
std::vector<ResourceMusic> musics_; // Vector con las musicas
std::vector<ResourceTexture> textures_; // Vector con las musicas
std::vector<ResourceTextFile> text_files_; // Vector con los ficheros de texto
std::vector<ResourceText> texts_; // Vector con los objetos de texto
std::vector<ResourceAnimation> animations_; // Vector con las animaciones
std::vector<DemoData> demos_; // Vector con los ficheros de datos para el modo demostración
@@ -102,6 +114,9 @@ private:
// Crea texturas
void createTextures();
// Crea los objetos de texto
void createText();
// [SINGLETON] Ahora el constructor y el destructor son privados, para no poder crear objetos resource desde fuera
// Constructor
@@ -132,6 +147,9 @@ public:
// Obtiene el fichero de texto a partir de un nombre
std::shared_ptr<TextFile> getTextFile(const std::string &name);
// Obtiene el objeto de texto a partir de un nombre
std::shared_ptr<Text> getText(const std::string &name);
// Obtiene la animación a partir de un nombre
AnimationsFileBuffer &getAnimation(const std::string &name);