clang-tidy (amb el fuck de que no feien bona parella el clang de macos i el tidy de llvm)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <utility>
|
||||
|
||||
#include "color.hpp"
|
||||
#include "param.hpp"
|
||||
@@ -86,7 +87,7 @@ void Fade::update(float delta_time) {
|
||||
void Fade::updatePreState() {
|
||||
Uint32 elapsed_time = SDL_GetTicks() - pre_start_time_;
|
||||
|
||||
if (elapsed_time >= static_cast<Uint32>(pre_duration_)) {
|
||||
if (std::cmp_greater_equal(elapsed_time, pre_duration_)) {
|
||||
state_ = State::FADING;
|
||||
fading_start_time_ = SDL_GetTicks(); // Inicia el temporizador del fade AQUI
|
||||
}
|
||||
@@ -125,7 +126,7 @@ void Fade::changeToPostState() {
|
||||
void Fade::updatePostState() {
|
||||
Uint32 elapsed_time = SDL_GetTicks() - post_start_time_;
|
||||
|
||||
if (elapsed_time >= static_cast<Uint32>(post_duration_)) {
|
||||
if (std::cmp_greater_equal(elapsed_time, post_duration_)) {
|
||||
state_ = State::FINISHED;
|
||||
}
|
||||
|
||||
@@ -147,7 +148,7 @@ void Fade::updateFullscreenFade() {
|
||||
value_ = static_cast<int>(progress * 100);
|
||||
|
||||
// Comprueba si ha terminado
|
||||
if (elapsed_time >= static_cast<Uint32>(fading_duration_)) {
|
||||
if (std::cmp_greater_equal(elapsed_time, fading_duration_)) {
|
||||
changeToPostState();
|
||||
}
|
||||
}
|
||||
@@ -171,7 +172,7 @@ void Fade::updateCenterFade() {
|
||||
value_ = static_cast<int>(progress * 100);
|
||||
|
||||
// Comprueba si ha terminado
|
||||
if (elapsed_time >= static_cast<Uint32>(fading_duration_)) {
|
||||
if (std::cmp_greater_equal(elapsed_time, fading_duration_)) {
|
||||
a_ = (mode_ == Mode::OUT) ? 255 : 0;
|
||||
changeToPostState();
|
||||
}
|
||||
@@ -202,7 +203,7 @@ void Fade::updateRandomSquareFade() {
|
||||
value_ = static_cast<int>(progress * 100);
|
||||
|
||||
// Comprueba si ha terminado
|
||||
if (elapsed_time >= static_cast<Uint32>(fading_duration_)) {
|
||||
if (std::cmp_greater_equal(elapsed_time, fading_duration_)) {
|
||||
changeToPostState();
|
||||
}
|
||||
}
|
||||
@@ -216,7 +217,7 @@ void Fade::updateRandomSquare2Fade() {
|
||||
|
||||
int squares_to_activate = 0;
|
||||
if (mode_ == Mode::OUT) {
|
||||
if (elapsed_time < static_cast<Uint32>(activation_time)) {
|
||||
if (std::cmp_less(elapsed_time, activation_time)) {
|
||||
float activation_progress = static_cast<float>(elapsed_time) / activation_time;
|
||||
squares_to_activate = static_cast<int>(activation_progress * total_squares);
|
||||
} else {
|
||||
@@ -237,7 +238,7 @@ void Fade::updateRandomSquare2Fade() {
|
||||
drawRandomSquares2();
|
||||
value_ = calculateValue(0, total_squares, squares_to_activate);
|
||||
|
||||
if (elapsed_time >= static_cast<Uint32>(fading_duration_)) {
|
||||
if (std::cmp_greater_equal(elapsed_time, fading_duration_)) {
|
||||
Uint8 final_alpha = (mode_ == Mode::OUT) ? 255 : 0;
|
||||
cleanBackbuffer(r_, g_, b_, final_alpha);
|
||||
changeToPostState();
|
||||
@@ -253,7 +254,7 @@ void Fade::updateDiagonalFade() {
|
||||
int max_diagonal = num_squares_width_ + num_squares_height_ - 1;
|
||||
int active_diagonals = 0;
|
||||
if (mode_ == Mode::OUT) {
|
||||
if (elapsed_time < static_cast<Uint32>(activation_time)) {
|
||||
if (std::cmp_less(elapsed_time, activation_time)) {
|
||||
float activation_progress = static_cast<float>(elapsed_time) / activation_time;
|
||||
active_diagonals = static_cast<int>(activation_progress * max_diagonal);
|
||||
} else {
|
||||
@@ -264,7 +265,7 @@ void Fade::updateDiagonalFade() {
|
||||
}
|
||||
} else {
|
||||
active_diagonals = max_diagonal;
|
||||
if (elapsed_time < static_cast<Uint32>(activation_time)) {
|
||||
if (std::cmp_less(elapsed_time, activation_time)) {
|
||||
float activation_progress = static_cast<float>(elapsed_time) / activation_time;
|
||||
int diagonals_starting_transition = static_cast<int>(activation_progress * max_diagonal);
|
||||
for (int diagonal = 0; diagonal < diagonals_starting_transition; ++diagonal) {
|
||||
@@ -280,7 +281,7 @@ void Fade::updateDiagonalFade() {
|
||||
drawDiagonal();
|
||||
value_ = calculateValue(0, max_diagonal, active_diagonals);
|
||||
|
||||
if (elapsed_time >= static_cast<Uint32>(fading_duration_)) {
|
||||
if (std::cmp_greater_equal(elapsed_time, fading_duration_)) {
|
||||
Uint8 final_alpha = (mode_ == Mode::OUT) ? 255 : 0;
|
||||
cleanBackbuffer(r_, g_, b_, final_alpha);
|
||||
changeToPostState();
|
||||
@@ -292,7 +293,7 @@ void Fade::activateDiagonal(int diagonal_index, Uint32 current_time) {
|
||||
int y = diagonal_index - x;
|
||||
if (y >= 0 && y < num_squares_height_) {
|
||||
int index = (y * num_squares_width_) + x;
|
||||
if (index >= 0 && index < static_cast<int>(square_age_.size()) && square_age_[index] == -1) {
|
||||
if (index >= 0 && std::cmp_less(index, square_age_.size()) && square_age_[index] == -1) {
|
||||
square_age_[index] = current_time;
|
||||
}
|
||||
}
|
||||
@@ -339,7 +340,7 @@ void Fade::drawRandomSquares(int active_count) {
|
||||
SDL_SetRenderDrawColor(renderer_, r_, g_, b_, a_);
|
||||
|
||||
// Dibuja solo los cuadrados activos
|
||||
for (int i = 0; i < active_count && i < static_cast<int>(square_.size()); ++i) {
|
||||
for (int i = 0; i < active_count && std::cmp_less(i, square_.size()); ++i) {
|
||||
SDL_RenderFillRect(renderer_, &square_[i]);
|
||||
}
|
||||
|
||||
@@ -394,7 +395,7 @@ void Fade::updateVenetianFade() {
|
||||
value_ = static_cast<int>(progress * 100);
|
||||
|
||||
// Comprueba si ha terminado
|
||||
if (elapsed_time >= static_cast<Uint32>(fading_duration_)) {
|
||||
if (std::cmp_greater_equal(elapsed_time, fading_duration_)) {
|
||||
changeToPostState();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user