afegit el namespace Logger
This commit is contained in:
@@ -294,32 +294,6 @@ auto stringInVector(const std::vector<std::string>& vec, const std::string& str)
|
||||
return std::ranges::find(vec, str) != vec.end();
|
||||
}
|
||||
|
||||
// Imprime por pantalla una línea de texto de tamaño fijo rellena con puntos
|
||||
void printWithDots(const std::string& text1, const std::string& text2, const std::string& text3) {
|
||||
constexpr size_t TOTAL_WIDTH = 52;
|
||||
|
||||
// Calcula el ancho del campo para text2 restando la longitud de text1 y text3
|
||||
size_t field_width = TOTAL_WIDTH > (text1.size() + text3.size())
|
||||
? TOTAL_WIDTH - text1.size() - text3.size()
|
||||
: 0;
|
||||
|
||||
// Prepara el bloque a imprimir a partir de text2
|
||||
std::string field_text;
|
||||
if (text2.size() < field_width) {
|
||||
// Si text2 es más corto, lo rellenamos a la derecha con puntos
|
||||
field_text = text2 + std::string(field_width - text2.size(), '.');
|
||||
} else {
|
||||
// Si es demasiado largo, lo cortamos
|
||||
field_text = text2.substr(0, field_width);
|
||||
}
|
||||
|
||||
// Concatena todo
|
||||
std::string formatted_text = text1 + field_text + text3;
|
||||
|
||||
// Imprime la línea formateada usando SDL_LogInfo
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%s", formatted_text.c_str());
|
||||
}
|
||||
|
||||
// Obtiene el nombre de un fichero a partir de una ruta completa
|
||||
auto getFileName(const std::string& path) -> std::string {
|
||||
return std::filesystem::path(path).filename().string();
|
||||
|
||||
Reference in New Issue
Block a user