This commit is contained in:
2025-10-27 18:35:53 +01:00
parent b1dca32a5b
commit 3179a08dac
63 changed files with 686 additions and 693 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <string> // para string, basic_string
#include <utility>
#include <vector> // para vector
#include "utils/utils.hpp"
@@ -31,8 +32,8 @@ class Asset {
bool required; // Indica si es un fichero que debe de existir
// Constructor
AssetItem(const std::string& file_path, AssetType asset_type, bool is_required)
: file(file_path),
AssetItem(std::string file_path, AssetType asset_type, bool is_required)
: file(std::move(file_path)),
type(asset_type),
required(is_required) {}
};
@@ -43,10 +44,10 @@ class Asset {
std::string executable_path_; // Ruta al ejecutable
// Comprueba que existe un fichero
static bool checkFile(const std::string& path);
static auto checkFile(const std::string& path) -> bool;
// Devuelve el nombre del tipo de recurso
static std::string getTypeName(AssetType type);
static auto getTypeName(AssetType type) -> std::string;
// Constructor
explicit Asset(const std::string& executable_path)
@@ -63,17 +64,17 @@ class Asset {
static void destroy();
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
static Asset* get();
static auto get() -> Asset*;
// Añade un elemento a la lista
void add(const std::string& file, AssetType type, bool required = true, bool absolute = false);
// Devuelve la ruta completa a un fichero a partir de una cadena
std::string get(const std::string& text) const;
[[nodiscard]] auto get(const std::string& text) const -> std::string;
// Comprueba que existen todos los elementos
bool check() const;
[[nodiscard]] auto check() const -> bool;
// Devuelve la lista de recursos de un tipo
std::vector<std::string> getListByType(AssetType type) const;
[[nodiscard]] auto getListByType(AssetType type) const -> std::vector<std::string>;
};