Primera implementación de la clase asset

This commit is contained in:
2021-09-08 18:26:22 +02:00
parent a0b14f5071
commit 94a06dcc2d
7 changed files with 114 additions and 123 deletions

View File

@@ -6,14 +6,15 @@
#ifndef ASSET_H
#define ASSET_H
enum assetType {bitmap, music, sound, data, font, lang};
#define ASSET_TYPE_BITMAP 0
#define ASSET_TYPE_MUSIC 1
#define ASSET_TYPE_SOUND 2
#define ASSET_TYPE_DATA 3
#define ASSET_TYPE_FONT 4
#define ASSET_TYPE_LANG 5
enum assetType
{
bitmap,
music,
sound,
data,
font,
lang
};
// Clase Asset
class Asset
@@ -22,11 +23,16 @@ private:
// Estructura para definir un item
struct item_t
{
std::string file;
enum assetType type;
std::string file; // Ruta del fichero desde la raiz del directorio
enum assetType type; // Indica el tipo de recurso
bool required; // Indica si es un fichero que debe de existir
};
std::vector<item_t> mFileList;
std::string mExecutablePath;
// Comprueba que existe un fichero
bool checkFile(std::string path);
public:
// Constructor
@@ -36,7 +42,13 @@ public:
~Asset();
// Añade un elemento a la lista
void add(std::string file, enum assetType type);
void add(std::string file, enum assetType type, bool required = true);
// Devuelve un elemento de la lista a partir de una cadena
std::string get(std::string text);
// Comprueba que existen todos los elementos
bool check();
};
#endif