jugant amb clang-tidy
This commit is contained in:
@@ -257,8 +257,8 @@ void Credits::fillCanvas() {
|
||||
|
||||
// Dibuja el rectangulo rojo
|
||||
// SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0xFF, 0, 0, 0xFF);
|
||||
const Color color = color_.LIGHTEN();
|
||||
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), color.r, color.g, color.b, 0xFF);
|
||||
const Color COLOR = color_.LIGHTEN();
|
||||
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), COLOR.r, COLOR.g, COLOR.b, 0xFF);
|
||||
SDL_RenderRect(Screen::get()->getRenderer(), &red_rect);
|
||||
|
||||
// Si el mini_logo está en su destino, lo dibuja encima de lo anterior
|
||||
@@ -305,19 +305,19 @@ void Credits::updateTextureDstRects() {
|
||||
|
||||
// Tira globos al escenario
|
||||
void Credits::throwBalloons() {
|
||||
constexpr int speed = 200;
|
||||
const std::vector<int> sets = {0, 63, 25, 67, 17, 75, 13, 50};
|
||||
constexpr int SPEED = 200;
|
||||
const std::vector<int> SETS = {0, 63, 25, 67, 17, 75, 13, 50};
|
||||
|
||||
if (counter_ > ((sets.size() - 1) * speed) * 3) {
|
||||
if (counter_ > ((SETS.size() - 1) * SPEED) * 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (counter_ % speed == 0) {
|
||||
const int index = (counter_ / speed) % sets.size();
|
||||
balloon_manager_->deploySet(sets.at(index), -60);
|
||||
if (counter_ % SPEED == 0) {
|
||||
const int INDEX = (counter_ / SPEED) % SETS.size();
|
||||
balloon_manager_->deploySet(SETS.at(INDEX), -60);
|
||||
}
|
||||
|
||||
if (counter_ % (speed * 4) == 0 && counter_ > 0) {
|
||||
if (counter_ % (SPEED * 4) == 0 && counter_ > 0) {
|
||||
balloon_manager_->createPowerBall();
|
||||
}
|
||||
}
|
||||
@@ -365,7 +365,7 @@ void Credits::initPlayers() {
|
||||
|
||||
// Actualiza los rectangulos negros
|
||||
void Credits::updateBlackRects() {
|
||||
static int current_step = steps_;
|
||||
static int current_step_ = steps_;
|
||||
if (top_black_rect_.h != param.game.game_area.center_y - 1 && bottom_black_rect_.y != param.game.game_area.center_y + 1) {
|
||||
// Si los rectangulos superior e inferior no han llegado al centro
|
||||
if (counter_ % 4 == 0) {
|
||||
@@ -376,8 +376,8 @@ void Credits::updateBlackRects() {
|
||||
++bottom_black_rect_.h;
|
||||
bottom_black_rect_.y = std::max(bottom_black_rect_.y - 1, param.game.game_area.center_y + 1);
|
||||
|
||||
--current_step;
|
||||
setVolume(static_cast<int>(initial_volume_ * current_step / steps_));
|
||||
--current_step_;
|
||||
setVolume(static_cast<int>(initial_volume_ * current_step_ / steps_));
|
||||
}
|
||||
} else {
|
||||
// Si los rectangulos superior e inferior han llegado al centro
|
||||
@@ -391,8 +391,8 @@ void Credits::updateBlackRects() {
|
||||
right_black_rect_.w += SPEED;
|
||||
right_black_rect_.x = std::max(right_black_rect_.x - SPEED, param.game.game_area.center_x);
|
||||
|
||||
--current_step;
|
||||
setVolume(static_cast<int>(initial_volume_ * current_step / steps_));
|
||||
--current_step_;
|
||||
setVolume(static_cast<int>(initial_volume_ * current_step_ / steps_));
|
||||
} else {
|
||||
// Si los rectangulos izquierdo y derecho han llegado al centro
|
||||
setVolume(0);
|
||||
@@ -452,33 +452,33 @@ void Credits::cycleColors() {
|
||||
constexpr int UPPER_LIMIT = 140; // Límite superior
|
||||
constexpr int LOWER_LIMIT = 30; // Límite inferior
|
||||
|
||||
static float r = static_cast<float>(UPPER_LIMIT);
|
||||
static float g = static_cast<float>(LOWER_LIMIT);
|
||||
static float b = static_cast<float>(LOWER_LIMIT);
|
||||
static float stepR = -0.5f; // Paso flotante para transiciones suaves
|
||||
static float stepG = 0.3f;
|
||||
static float stepB = 0.1f;
|
||||
static float r_ = static_cast<float>(UPPER_LIMIT);
|
||||
static float g_ = static_cast<float>(LOWER_LIMIT);
|
||||
static float b_ = static_cast<float>(LOWER_LIMIT);
|
||||
static float step_r_ = -0.5f; // Paso flotante para transiciones suaves
|
||||
static float step_g_ = 0.3f;
|
||||
static float step_b_ = 0.1f;
|
||||
|
||||
// Ajustar valores de R
|
||||
r += stepR;
|
||||
if (r >= UPPER_LIMIT || r <= LOWER_LIMIT) {
|
||||
stepR = -stepR; // Cambia de dirección al alcanzar los límites
|
||||
r_ += step_r_;
|
||||
if (r_ >= UPPER_LIMIT || r_ <= LOWER_LIMIT) {
|
||||
step_r_ = -step_r_; // Cambia de dirección al alcanzar los límites
|
||||
}
|
||||
|
||||
// Ajustar valores de G
|
||||
g += stepG;
|
||||
if (g >= UPPER_LIMIT || g <= LOWER_LIMIT) {
|
||||
stepG = -stepG; // Cambia de dirección al alcanzar los límites
|
||||
g_ += step_g_;
|
||||
if (g_ >= UPPER_LIMIT || g_ <= LOWER_LIMIT) {
|
||||
step_g_ = -step_g_; // Cambia de dirección al alcanzar los límites
|
||||
}
|
||||
|
||||
// Ajustar valores de B
|
||||
b += stepB;
|
||||
if (b >= UPPER_LIMIT || b <= LOWER_LIMIT) {
|
||||
stepB = -stepB; // Cambia de dirección al alcanzar los límites
|
||||
b_ += step_b_;
|
||||
if (b_ >= UPPER_LIMIT || b_ <= LOWER_LIMIT) {
|
||||
step_b_ = -step_b_; // Cambia de dirección al alcanzar los límites
|
||||
}
|
||||
|
||||
// Aplicar el color, redondeando a enteros antes de usar
|
||||
color_ = Color(static_cast<int>(r), static_cast<int>(g), static_cast<int>(b));
|
||||
color_ = Color(static_cast<int>(r_), static_cast<int>(g_), static_cast<int>(b_));
|
||||
tiled_bg_->setColor(color_);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user