Don melitonada la classe Asset

This commit is contained in:
2024-09-28 13:49:00 +02:00
parent 878518babe
commit fa82758ce1
23 changed files with 99 additions and 56 deletions

View File

@@ -1,6 +1,27 @@
#include "asset.h"
#include <iostream>
// [SINGLETON] Hay que definir las variables estáticas, desde el .h sólo la hemos declarado
Asset *Asset::asset = nullptr;
// [SINGLETON] Crearemos el objeto asset con esta función estática
void Asset::init(std::string executablePath)
{
Asset::asset = new Asset(executablePath);
}
// [SINGLETON] Destruiremos el objeto asset con esta función estática
void Asset::destroy()
{
delete Asset::asset;
}
// [SINGLETON] Con este método obtenemos el objeto asset y podemos trabajar con él
Asset *Asset::get()
{
return Asset::asset;
}
// Constructor
Asset::Asset(std::string executablePath)
{
@@ -13,6 +34,12 @@ Asset::Asset(std::string executablePath)
#endif
}
// Destructor
Asset::~Asset()
{
}
// Añade un elemento a la lista
void Asset::add(std::string file, enum assetType type, bool required, bool absolute)
{