clang-tidy readability

This commit is contained in:
2025-07-20 14:56:00 +02:00
parent f5245273a1
commit ca99f7be34
57 changed files with 623 additions and 557 deletions

View File

@@ -113,7 +113,7 @@ void Instructions::fillTexture() {
const int DESP_X = param.game.item_size + 8;
// Modifica el renderizador para pintar en la textura
auto temp = SDL_GetRenderTarget(renderer_);
auto *temp = SDL_GetRenderTarget(renderer_);
SDL_SetRenderTarget(renderer_, texture_);
// Limpia la textura
@@ -128,9 +128,9 @@ void Instructions::fillTexture() {
constexpr int SPACE_POST_HEADER = 20;
constexpr int SPACE_PRE_HEADER = 28;
const int SPACE_BETWEEN_LINES = text_->getCharacterSize() * 1.5f;
const int SPACE_BETWEEN_LINES = text_->getCharacterSize() * 1.5F;
const int SPACE_BETWEEN_ITEM_LINES = param.game.item_size + item_space_;
const int SPACE_NEW_PARAGRAPH = SPACE_BETWEEN_LINES * 0.5f;
const int SPACE_NEW_PARAGRAPH = SPACE_BETWEEN_LINES * 0.5F;
const int SIZE = (NUM_LINES * SPACE_BETWEEN_LINES) + (NUM_ITEM_LINES * SPACE_BETWEEN_ITEM_LINES) + (NUM_POST_HEADERS * SPACE_POST_HEADER) + (NUM_PRE_HEADERS * SPACE_PRE_HEADER) + (SPACE_NEW_PARAGRAPH);
const int FIRST_LINE = (param.game.height - SIZE) / 2;
@@ -182,7 +182,7 @@ void Instructions::fillTexture() {
// Rellena el backbuffer
void Instructions::fillBackbuffer() {
// Modifica el renderizador para pintar en la textura
auto temp = SDL_GetRenderTarget(renderer_);
auto *temp = SDL_GetRenderTarget(renderer_);
SDL_SetRenderTarget(renderer_, backbuffer_);
// Limpia la textura
@@ -242,10 +242,11 @@ void Instructions::render() {
tiled_bg_->render();
// Copia la textura y el backbuffer al renderizador
if (view_.y == 0)
if (view_.y == 0) {
renderLines(renderer_, backbuffer_, lines_);
else
} else {
SDL_RenderTexture(renderer_, backbuffer_, nullptr, &view_);
}
fade_->render();
@@ -283,7 +284,7 @@ auto Instructions::initializeLines(int height) -> std::vector<Line> {
std::vector<Line> lines;
for (int y = 0; y < height; y++) {
int direction = (y % 2 == 0) ? -1 : 1; // Pares a la izquierda, impares a la derecha
lines.emplace_back(y, 0.0f, direction);
lines.emplace_back(y, 0.0F, direction);
}
return lines;
}
@@ -299,7 +300,7 @@ auto Instructions::moveLines(std::vector<Line> &lines, int width, float duration
line.start_time = current_time + line.y * start_delay;
}
float elapsed_time = (current_time - line.start_time) / 1000.0f; // Convertir a segundos
float elapsed_time = (current_time - line.start_time) / 1000.0F; // Convertir a segundos
if (elapsed_time < 0) {
all_lines_off_screen = false; // Si aún no se debe mover esta línea, no están todas fuera de pantalla
continue;
@@ -329,7 +330,7 @@ void Instructions::renderLines(SDL_Renderer *renderer, SDL_Texture *texture, con
// Gestiona la textura con los graficos
void Instructions::updateBackbuffer() {
// Establece la ventana del backbuffer
view_.y = std::max(0.0f, param.game.height - counter_ + 100);
view_.y = std::max(0.0F, param.game.height - counter_ + 100);
// Verifica si view_.y == 0 y gestiona el temporizador
if (view_.y == 0) {
@@ -339,7 +340,7 @@ void Instructions::updateBackbuffer() {
start_delay_time_ = SDL_GetTicks();
} else if (SDL_GetTicks() - start_delay_time_ >= 4000) {
// Han pasado tres segundos, mover líneas
all_lines_off_screen_ = moveLines(lines_, 320, 1.0f, 5);
all_lines_off_screen_ = moveLines(lines_, 320, 1.0F, 5);
}
}