renombrades extensions .h a .hpp
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include "asset_integrated.h"
|
||||
#include "asset_integrated.hpp"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
@@ -6,13 +6,13 @@
|
||||
|
||||
bool AssetIntegrated::resource_pack_enabled_ = false;
|
||||
|
||||
void AssetIntegrated::initWithResourcePack(const std::string &executable_path,
|
||||
const std::string &resource_pack_path) {
|
||||
void AssetIntegrated::initWithResourcePack(const std::string& executable_path,
|
||||
const std::string& resource_pack_path) {
|
||||
// Inicializar Asset normal
|
||||
Asset::init(executable_path);
|
||||
|
||||
// Inicializar ResourceLoader
|
||||
auto &loader = ResourceLoader::getInstance();
|
||||
auto& loader = ResourceLoader::getInstance();
|
||||
if (loader.initialize(resource_pack_path, true)) {
|
||||
resource_pack_enabled_ = true;
|
||||
std::cout << "Asset system initialized with resource pack: " << resource_pack_path << std::endl;
|
||||
@@ -22,10 +22,10 @@ void AssetIntegrated::initWithResourcePack(const std::string &executable_path,
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint8_t> AssetIntegrated::loadFile(const std::string &filename) {
|
||||
std::vector<uint8_t> AssetIntegrated::loadFile(const std::string& filename) {
|
||||
if (shouldUseResourcePack(filename) && resource_pack_enabled_) {
|
||||
// Intentar cargar del pack de recursos
|
||||
auto &loader = ResourceLoader::getInstance();
|
||||
auto& loader = ResourceLoader::getInstance();
|
||||
|
||||
// Convertir ruta completa a ruta relativa para el pack
|
||||
std::string relativePath = filename;
|
||||
@@ -53,7 +53,7 @@ std::vector<uint8_t> AssetIntegrated::loadFile(const std::string &filename) {
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
std::vector<uint8_t> data(fileSize);
|
||||
if (!file.read(reinterpret_cast<char *>(data.data()), fileSize)) {
|
||||
if (!file.read(reinterpret_cast<char*>(data.data()), fileSize)) {
|
||||
std::cerr << "Error: Could not read file: " << filename << std::endl;
|
||||
return {};
|
||||
}
|
||||
@@ -61,9 +61,9 @@ std::vector<uint8_t> AssetIntegrated::loadFile(const std::string &filename) {
|
||||
return data;
|
||||
}
|
||||
|
||||
bool AssetIntegrated::fileExists(const std::string &filename) const {
|
||||
bool AssetIntegrated::fileExists(const std::string& filename) const {
|
||||
if (shouldUseResourcePack(filename) && resource_pack_enabled_) {
|
||||
auto &loader = ResourceLoader::getInstance();
|
||||
auto& loader = ResourceLoader::getInstance();
|
||||
|
||||
// Convertir ruta completa a ruta relativa para el pack
|
||||
std::string relativePath = filename;
|
||||
@@ -81,12 +81,12 @@ bool AssetIntegrated::fileExists(const std::string &filename) const {
|
||||
return std::filesystem::exists(filename);
|
||||
}
|
||||
|
||||
std::string AssetIntegrated::getSystemPath(const std::string &filename) const {
|
||||
std::string AssetIntegrated::getSystemPath(const std::string& filename) const {
|
||||
// Los archivos de sistema/config siempre van al filesystem
|
||||
return filename;
|
||||
}
|
||||
|
||||
bool AssetIntegrated::shouldUseResourcePack(const std::string &filepath) const {
|
||||
bool AssetIntegrated::shouldUseResourcePack(const std::string& filepath) const {
|
||||
// Los archivos que NO van al pack:
|
||||
// - Archivos de config/ (ahora están fuera de data/)
|
||||
// - Archivos con absolute=true en assets.txt
|
||||
|
||||
Reference in New Issue
Block a user