clang-tidy readability-function-cognitive-complexity
This commit is contained in:
@@ -42,7 +42,7 @@ Credits::Credits()
|
||||
fade_out_(std::make_unique<Fade>()),
|
||||
text_texture_(SDL_CreateTexture(Screen::get()->getRenderer(), SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)),
|
||||
canvas_(SDL_CreateTexture(Screen::get()->getRenderer(), SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, param.game.width, param.game.height)) {
|
||||
if (!text_texture_) {
|
||||
if (text_texture_ == nullptr) {
|
||||
throw std::runtime_error("Failed to create SDL texture for text.");
|
||||
}
|
||||
Section::name = Section::Name::CREDITS;
|
||||
@@ -133,7 +133,7 @@ void Credits::checkInput() {
|
||||
|
||||
if (!ServiceMenu::get()->isEnabled()) {
|
||||
// Comprueba si se ha pulsado cualquier botón (de los usados para jugar)
|
||||
if (Input::get()->checkAnyButton(INPUT_ALLOW_REPEAT)) {
|
||||
if (Input::get()->checkAnyButton(INPUT_ALLOW_REPEAT) != 0) {
|
||||
want_to_pass_ = true;
|
||||
fading_ = mini_logo_on_position_;
|
||||
} else {
|
||||
@@ -235,7 +235,7 @@ void Credits::fillTextTexture() {
|
||||
// Dibuja todos los sprites en la textura
|
||||
void Credits::fillCanvas() {
|
||||
// Cambia el destino del renderizador
|
||||
auto temp = SDL_GetRenderTarget(Screen::get()->getRenderer());
|
||||
auto *temp = SDL_GetRenderTarget(Screen::get()->getRenderer());
|
||||
SDL_SetRenderTarget(Screen::get()->getRenderer(), canvas_);
|
||||
|
||||
// Dibuja el fondo, los globos y los jugadores
|
||||
@@ -378,7 +378,7 @@ void Credits::updateBlackRects() {
|
||||
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_));
|
||||
setVolume((initial_volume_ * current_step_ / steps_));
|
||||
}
|
||||
} else {
|
||||
// Si los rectangulos superior e inferior han llegado al centro
|
||||
@@ -393,7 +393,7 @@ void Credits::updateBlackRects() {
|
||||
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_));
|
||||
setVolume((initial_volume_ * current_step_ / steps_));
|
||||
} else {
|
||||
// Si los rectangulos izquierdo y derecho han llegado al centro
|
||||
setVolume(0);
|
||||
@@ -440,7 +440,7 @@ void Credits::setVolume(int amount) {
|
||||
}
|
||||
|
||||
// Reestablece el nivel de volumen
|
||||
void Credits::resetVolume() {
|
||||
void Credits::resetVolume() const {
|
||||
Options::audio.music.volume = initial_volume_;
|
||||
Audio::get()->setMusicVolume(Options::audio.music.volume);
|
||||
}
|
||||
@@ -456,9 +456,9 @@ void Credits::cycleColors() {
|
||||
static auto r_ = static_cast<float>(UPPER_LIMIT);
|
||||
static auto g_ = static_cast<float>(LOWER_LIMIT);
|
||||
static auto 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;
|
||||
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_ += step_r_;
|
||||
|
||||
Reference in New Issue
Block a user