forked from jaildesigner-jailgames/jaildoctors_dilemma
actualitzada la carpeta release a SDL3
migrat a resources.pack
This commit is contained in:
@@ -58,10 +58,22 @@ void Asset::loadFromFile(const std::string& config_file_path, const std::string&
|
||||
return;
|
||||
}
|
||||
|
||||
// Read entire file into string
|
||||
std::stringstream buffer;
|
||||
buffer << file.rdbuf();
|
||||
file.close();
|
||||
|
||||
// Parse using loadFromString
|
||||
loadFromString(buffer.str(), prefix, system_folder);
|
||||
}
|
||||
|
||||
// Carga recursos desde un string de configuración (para release con pack)
|
||||
void Asset::loadFromString(const std::string& config_content, const std::string& prefix, const std::string& system_folder) {
|
||||
std::istringstream stream(config_content);
|
||||
std::string line;
|
||||
int line_number = 0;
|
||||
|
||||
while (std::getline(file, line)) {
|
||||
while (std::getline(stream, line)) {
|
||||
++line_number;
|
||||
|
||||
// Limpiar espacios en blanco al principio y final
|
||||
@@ -85,7 +97,7 @@ void Asset::loadFromFile(const std::string& config_file_path, const std::string&
|
||||
// Verificar que tenemos al menos tipo y ruta
|
||||
if (parts.size() < 2) {
|
||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Warning: Malformed line %d in config file (insufficient fields)",
|
||||
"Warning: Malformed line %d in config (insufficient fields)",
|
||||
line_number);
|
||||
continue;
|
||||
}
|
||||
@@ -114,14 +126,13 @@ void Asset::loadFromFile(const std::string& config_file_path, const std::string&
|
||||
|
||||
} catch (const std::exception& e) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Error parsing line %d in config file: %s",
|
||||
"Error parsing line %d in config: %s",
|
||||
line_number,
|
||||
e.what());
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Loaded " << file_list_.size() << " assets from config file" << '\n';
|
||||
file.close();
|
||||
std::cout << "Loaded " << file_list_.size() << " assets from config" << '\n';
|
||||
}
|
||||
|
||||
// Devuelve la ruta completa a un fichero (búsqueda O(1))
|
||||
|
||||
Reference in New Issue
Block a user