diff --git a/resources.pack b/resources.pack new file mode 100644 index 0000000..672954c Binary files /dev/null and b/resources.pack differ diff --git a/source/main.cpp b/source/main.cpp index 73e2fc3..6d68994 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -72,6 +72,9 @@ int main(int argc, char* argv[]) { } } + // Inicializar sistema de recursos empaquetados (intentar cargar resources.pack) + Texture::initResourceSystem("resources.pack"); + Engine engine; if (!engine.initialize(width, height, zoom, fullscreen)) { diff --git a/source/resource_pack.cpp b/source/resource_pack.cpp index d6b4f30..62f8f5d 100644 --- a/source/resource_pack.cpp +++ b/source/resource_pack.cpp @@ -257,15 +257,16 @@ std::string ResourcePack::normalizePath(const std::string& path) { // Reemplazar \ por / std::replace(normalized.begin(), normalized.end(), '\\', '/'); - // Eliminar ./ del inicio + // Buscar "data/" en cualquier parte del path y extraer lo que viene después + size_t data_pos = normalized.find("data/"); + if (data_pos != std::string::npos) { + normalized = normalized.substr(data_pos + 5); // +5 para saltar "data/" + } + + // Eliminar ./ del inicio si quedó if (normalized.substr(0, 2) == "./") { normalized = normalized.substr(2); } - // Eliminar data/ del inicio si existe - if (normalized.substr(0, 5) == "data/") { - normalized = normalized.substr(5); - } - return normalized; }