millorat printWithDots() i Resource::List per a calcular el nom de fitxer mes llarg correctament
This commit is contained in:
@@ -16,7 +16,9 @@
|
||||
|
||||
#include "core/rendering/gif.hpp" // Para Gif
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
#include "core/resources/resource_list.hpp" // Para Resource::List::get()->getPrintWidth
|
||||
#include "core/resources/resource_helper.hpp" // Para ResourceHelper
|
||||
#include "utils/utils.hpp" // Para printWithDots
|
||||
|
||||
// Carga una paleta desde un archivo .gif
|
||||
auto loadPalette(const std::string& file_path) -> Palette {
|
||||
@@ -37,7 +39,7 @@ auto loadPalette(const std::string& file_path) -> Palette {
|
||||
std::copy_n(pal.begin(), std::min(pal.size(), palette.size()), palette.begin());
|
||||
|
||||
// Mensaje de depuración
|
||||
printWithDots("Palette : ", file_path.substr(file_path.find_last_of("\\/") + 1), "[ LOADED ]");
|
||||
printWithDots("Palette : ", file_path.substr(file_path.find_last_of("\\/") + 1), "[ LOADED ]", Resource::List::get()->getPrintWidth());
|
||||
|
||||
return palette;
|
||||
}
|
||||
@@ -86,7 +88,7 @@ auto readPalFile(const std::string& file_path) -> Palette {
|
||||
}
|
||||
}
|
||||
|
||||
printWithDots("Palette : ", file_path.substr(file_path.find_last_of("\\/") + 1), "[ LOADED ]");
|
||||
printWithDots("Palette : ", file_path.substr(file_path.find_last_of("\\/") + 1), "[ LOADED ]", Resource::List::get()->getPrintWidth());
|
||||
return palette;
|
||||
}
|
||||
|
||||
@@ -128,7 +130,7 @@ auto Surface::loadSurface(const std::string& file_path) -> SurfaceData {
|
||||
std::memcpy(pixels.get(), raw_pixels.data(), pixel_count);
|
||||
|
||||
// Crear y devolver directamente el objeto SurfaceData
|
||||
printWithDots("Surface : ", file_path.substr(file_path.find_last_of("\\/") + 1), "[ LOADED ]");
|
||||
printWithDots("Surface : ", file_path.substr(file_path.find_last_of("\\/") + 1), "[ LOADED ]", Resource::List::get()->getPrintWidth());
|
||||
return {static_cast<float>(w), static_cast<float>(h), pixels};
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#include <utility>
|
||||
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/resources/resource_cache.hpp" // Para Resource
|
||||
#include "core/resources/resource_cache.hpp" // Para Resource::Cache
|
||||
#include "core/resources/resource_list.hpp" // Para Resource::List::get()->getPrintWidth
|
||||
#include "core/resources/resource_helper.hpp" // Para ResourceHelper
|
||||
#include "external/fkyaml_node.hpp" // Para fkyaml::node
|
||||
#include "utils/utils.hpp" // Para printWithDots
|
||||
@@ -46,7 +47,7 @@ auto SurfaceAnimatedSprite::loadAnimationsFromYAML(const std::string& file_path,
|
||||
throw std::runtime_error("Animation file not found: " + file_path);
|
||||
}
|
||||
|
||||
printWithDots("Animation : ", FILE_NAME, "[ LOADED ]");
|
||||
printWithDots("Animation : ", FILE_NAME, "[ LOADED ]", Resource::List::get()->getPrintWidth());
|
||||
|
||||
// Parse YAML from string
|
||||
std::string yaml_content(file_data.begin(), file_data.end());
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "core/rendering/screen.hpp" // Para Screen
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "core/rendering/surface_sprite.hpp" // Para SSprite
|
||||
#include "core/resources/resource_list.hpp" // Para Resource::List::get()->getPrintWidth
|
||||
#include "core/resources/resource_helper.hpp" // Para ResourceHelper
|
||||
#include "utils/utils.hpp" // Para getFileName, stringToColor, printWithDots
|
||||
|
||||
@@ -75,7 +76,7 @@ auto Text::loadTextFile(const std::string& file_path) -> std::shared_ptr<File> {
|
||||
line_read++;
|
||||
};
|
||||
|
||||
printWithDots("Text File : ", getFileName(file_path), "[ LOADED ]");
|
||||
printWithDots("Text File : ", getFileName(file_path), "[ LOADED ]", Resource::List::get()->getPrintWidth());
|
||||
|
||||
// Establece las coordenadas para cada caracter ascii de la cadena y su ancho
|
||||
for (int i = 32; i < 128; ++i) {
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
#include <utility>
|
||||
#include <vector> // Para vector
|
||||
|
||||
#include "utils/utils.hpp" // Para getFileName, ColorRGB, printWithDots
|
||||
#include "core/resources/resource_list.hpp" // Para Resource::List::get()->getPrintWidth
|
||||
#include "utils/utils.hpp" // Para getFileName, ColorRGB, printWithDots
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "external/stb_image.h" // para stbi_failure_reason, stbi_image_free
|
||||
@@ -51,7 +52,7 @@ auto Texture::loadFromFile(const std::string& file_path) -> bool {
|
||||
std::cerr << "Error: Fichero no encontrado " << getFileName(file_path) << '\n';
|
||||
throw std::runtime_error("Fichero no encontrado: " + getFileName(file_path));
|
||||
}
|
||||
printWithDots("Image : ", getFileName(file_path), "[ LOADED ]");
|
||||
printWithDots("Image : ", getFileName(file_path), "[ LOADED ]", Resource::List::get()->getPrintWidth());
|
||||
|
||||
int pitch;
|
||||
SDL_PixelFormat pixel_format;
|
||||
|
||||
Reference in New Issue
Block a user