clang-tidy readability
This commit is contained in:
@@ -57,7 +57,7 @@ Scoreboard::Scoreboard()
|
||||
recalculateAnchors();
|
||||
power_meter_sprite_->setPosition(SDL_FRect{
|
||||
static_cast<float>(slot4_2_.x - 20),
|
||||
static_cast<float>(slot4_2_.y),
|
||||
slot4_2_.y,
|
||||
40,
|
||||
7});
|
||||
|
||||
@@ -76,12 +76,12 @@ Scoreboard::Scoreboard()
|
||||
}
|
||||
|
||||
Scoreboard::~Scoreboard() {
|
||||
if (background_) {
|
||||
if (background_ != nullptr) {
|
||||
SDL_DestroyTexture(background_);
|
||||
}
|
||||
|
||||
for (auto texture : panel_texture_) {
|
||||
if (texture) {
|
||||
for (auto *texture : panel_texture_) {
|
||||
if (texture != nullptr) {
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ void Scoreboard::setPos(SDL_FRect rect) {
|
||||
// Rellena los diferentes paneles del marcador
|
||||
void Scoreboard::fillPanelTextures() {
|
||||
// Guarda a donde apunta actualmente el renderizador
|
||||
auto temp = SDL_GetRenderTarget(renderer_);
|
||||
auto *temp = SDL_GetRenderTarget(renderer_);
|
||||
|
||||
// Genera el contenido de cada panel_
|
||||
for (size_t i = 0; i < SCOREBOARD_MAX_PANELS; ++i) {
|
||||
@@ -208,12 +208,12 @@ void Scoreboard::fillPanelTextures() {
|
||||
// POWERMETER
|
||||
power_meter_sprite_->setSpriteClip(0, 0, 40, 7);
|
||||
power_meter_sprite_->render();
|
||||
power_meter_sprite_->setSpriteClip(40, 0, int(power_ * 40.0f), 7);
|
||||
power_meter_sprite_->setSpriteClip(40, 0, int(power_ * 40.0F), 7);
|
||||
power_meter_sprite_->render();
|
||||
|
||||
// HI-SCORE
|
||||
text_scoreboard_->writeDX(TEXT_CENTER | TEXT_COLOR, slot4_3_.x, slot4_3_.y, Lang::getText("[SCOREBOARD] 4"), 1, text_color1_);
|
||||
const std::string NAME = hi_score_name_ == "" ? "" : hi_score_name_ + " - ";
|
||||
const std::string NAME = hi_score_name_.empty() ? "" : hi_score_name_ + " - ";
|
||||
text_scoreboard_->writeDX(TEXT_CENTER | TEXT_COLOR, slot4_4_.x, slot4_4_.y, NAME + updateScoreText(hi_score_), 1, text_color2_);
|
||||
break;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ void Scoreboard::fillPanelTextures() {
|
||||
// ENTER NAME
|
||||
{
|
||||
text_scoreboard_->writeDX(TEXT_CENTER | TEXT_COLOR, slot4_3_.x, slot4_3_.y, Lang::getText("[SCOREBOARD] 11"), 1, text_color1_);
|
||||
SDL_FRect rect = {enter_name_pos_.x, enter_name_pos_.y, 5.0f, 7.0f};
|
||||
SDL_FRect rect = {enter_name_pos_.x, enter_name_pos_.y, 5.0F, 7.0F};
|
||||
|
||||
// Recorre todos los slots de letras del nombre
|
||||
for (size_t j = 0; j < NAME_SIZE; ++j) {
|
||||
@@ -323,7 +323,7 @@ void Scoreboard::fillBackgroundTexture() {
|
||||
// Recalcula las anclas de los elementos
|
||||
void Scoreboard::recalculateAnchors() {
|
||||
// Recalcula la posición y el tamaño de los paneles
|
||||
const float PANEL_WIDTH = (float)rect_.w / (float)SCOREBOARD_MAX_PANELS;
|
||||
const float PANEL_WIDTH = rect_.w / (float)SCOREBOARD_MAX_PANELS;
|
||||
for (int i = 0; i < SCOREBOARD_MAX_PANELS; ++i) {
|
||||
panel_[i].pos.x = roundf(PANEL_WIDTH * i);
|
||||
panel_[i].pos.y = 0;
|
||||
@@ -365,7 +365,7 @@ void Scoreboard::recalculateAnchors() {
|
||||
// Crea la textura de fondo
|
||||
void Scoreboard::createBackgroundTexture() {
|
||||
// Elimina la textura en caso de existir
|
||||
if (background_) {
|
||||
if (background_ != nullptr) {
|
||||
SDL_DestroyTexture(background_);
|
||||
}
|
||||
|
||||
@@ -377,7 +377,7 @@ void Scoreboard::createBackgroundTexture() {
|
||||
// Crea las texturas de los paneles
|
||||
void Scoreboard::createPanelTextures() {
|
||||
// Elimina las texturas en caso de existir
|
||||
for (auto texture : panel_texture_) {
|
||||
for (auto *texture : panel_texture_) {
|
||||
if (texture != nullptr) {
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user