Arreglades les herencies de Sprite

Abans de llevar mil coses que sobren i replantejar-se estes 4 classes
This commit is contained in:
2024-10-13 10:01:07 +02:00
parent 33ea8d90ca
commit b060f21696
17 changed files with 1204 additions and 284 deletions

View File

@@ -1,7 +1,7 @@
#pragma once
#include <string> // for string, basic_string
#include <vector> // for vector
#include <string> // for string, basic_string
#include <vector> // for vector
enum class AssetType : int
{
@@ -22,7 +22,7 @@ class Asset
{
private:
// [SINGLETON] Objeto asset privado para Don Melitón
static Asset *asset;
static Asset *asset_;
// Estructura para definir un item
struct AssetItem
@@ -34,25 +34,25 @@ private:
};
// Variables
int longest_name_; // Contiene la longitud del nombre de fichero mas largo
int longest_name_; // Contiene la longitud del nombre de fichero mas largo
std::vector<AssetItem> file_list_; // Listado con todas las rutas a los ficheros
std::string executable_path_; // Ruta al ejecutable
std::string executable_path_; // Ruta al ejecutable
// Comprueba que existe un fichero
bool checkFile(std::string executable_path) const;
bool checkFile(const std::string &path) const;
// Devuelve el nombre del tipo de recurso
std::string getTypeName(AssetType type) const;
// Constructor
Asset(std::string path);
explicit Asset(const std::string &executable_path);
// Destructor
~Asset() = default;
public:
// [SINGLETON] Crearemos el objeto screen con esta función estática
static void init(std::string path);
static void init(const std::string &executable_path);
// [SINGLETON] Destruiremos el objeto screen con esta función estática
static void destroy();
@@ -61,10 +61,10 @@ public:
static Asset *get();
// Añade un elemento a la lista
void add(std::string file, AssetType type, bool required = true, bool absolute = false);
void add(const std::string &file, AssetType type, bool required = true, bool absolute = false);
// Devuelve un elemento de la lista a partir de una cadena
std::string get(std::string text) const;
std::string get(const std::string &text) const;
// Comprueba que existen todos los elementos
bool check() const;