afegit SDL_ScaleMode scale_mode a VideoOptions
This commit is contained in:
@@ -302,28 +302,28 @@ bool stringInVector(const std::vector<std::string> &vec, const std::string &str)
|
||||
// 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)
|
||||
{
|
||||
const size_t TOTAL_WIDTH = 50;
|
||||
constexpr size_t TOTAL_WIDTH = 52;
|
||||
|
||||
// Calcula el ancho del campo para text2 restando la longitud de text1 y text3
|
||||
size_t fieldWidth = TOTAL_WIDTH > (text1.size() + text3.size())
|
||||
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 fieldText;
|
||||
if (text2.size() < fieldWidth)
|
||||
std::string field_text;
|
||||
if (text2.size() < field_width)
|
||||
{
|
||||
// Si text2 es más corto, lo rellenamos a la derecha con puntos
|
||||
fieldText = text2 + std::string(fieldWidth - text2.size(), '.');
|
||||
field_text = text2 + std::string(field_width - text2.size(), '.');
|
||||
}
|
||||
else
|
||||
{
|
||||
// Si es demasiado largo, lo cortamos
|
||||
fieldText = text2.substr(0, fieldWidth);
|
||||
field_text = text2.substr(0, field_width);
|
||||
}
|
||||
|
||||
// Concatena todo
|
||||
std::string formatted_text = text1 + fieldText + text3;
|
||||
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());
|
||||
|
||||
Reference in New Issue
Block a user