clang-format

clang-tidy (macos)
This commit is contained in:
2026-03-23 07:26:21 +01:00
parent 0ddb6c85e1
commit 6595b28790
65 changed files with 583 additions and 570 deletions

View File

@@ -50,7 +50,7 @@ Title::Title()
}
// Destructor
Title::~Title() {
Title::~Title() { // NOLINT(modernize-use-equals-default)
loading_screen_surface_->resetSubPalette();
title_surface_->resetSubPalette();
}
@@ -66,7 +66,7 @@ void Title::initMarquee() {
uint32_t cp = Text::nextCodepoint(long_text_, pos);
Glyph l;
l.codepoint = cp;
l.clip = marquee_text_->getGlyphClip(cp); // Pre-calcular clip rect (evita búsqueda por frame)
l.clip = marquee_text_->getGlyphClip(cp); // Pre-calcular clip rect (evita búsqueda por frame)
l.x = MARQUEE_START_X;
l.width = static_cast<float>(marquee_text_->glyphWidth(cp, 0)); // Pre-calcular ancho visual del glifo
l.enabled = false;
@@ -223,7 +223,7 @@ void Title::updateMarquee(float delta_time) {
}
// Dibuja la marquesina
void Title::renderMarquee() {
void Title::renderMarquee() const {
auto* sprite = marquee_text_->getSprite();
sprite->setY(MARQUEE_Y);
// Solo renderizar letras activas (optimización: usa cache y rangos)
@@ -442,7 +442,7 @@ void Title::run() {
}
// Crea y rellena la textura para mostrar los logros
void Title::createCheevosTexture() {
void Title::createCheevosTexture() { // NOLINT(readability-convert-member-functions-to-static)
// Define la zona central del menu (entre el logo y la marquesina)
constexpr int MENU_ZONE_Y = 73; // Top of menu zone
constexpr int MENU_ZONE_HEIGHT = 102; // Height of menu zone
@@ -466,7 +466,7 @@ void Title::createCheevosTexture() {
cheevos_surface_->clear(CHEEVOS_BG_COLOR);
// Escribe la lista de logros en la textura
const std::string CHEEVOS_OWNER = Locale::get()->get("title.projects");
const std::string CHEEVOS_OWNER = Locale::get()->get("title.projects"); // NOLINT(readability-static-accessed-through-instance)
const std::string CHEEVOS_LIST_CAPTION = CHEEVOS_OWNER + " (" + std::to_string(Cheevos::get()->getTotalUnlockedAchievements()) + " / " + std::to_string(Cheevos::get()->size()) + ")";
int pos = 2;
TEXT->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, cheevos_surface_->getWidth() / 2, pos, CHEEVOS_LIST_CAPTION, 1, stringToColor("bright_green"));
@@ -632,7 +632,7 @@ auto Title::isKeyValid(SDL_Scancode scancode) -> bool {
}
// Verifica si una tecla ya fue usada en pasos anteriores
auto Title::isKeyDuplicate(SDL_Scancode scancode, int current_step) -> bool {
auto Title::isKeyDuplicate(SDL_Scancode scancode, int current_step) -> bool { // NOLINT(readability-convert-member-functions-to-static)
for (int i = 0; i < current_step; i++) {
if (temp_keys_[i] == scancode) {
return true;
@@ -642,7 +642,7 @@ auto Title::isKeyDuplicate(SDL_Scancode scancode, int current_step) -> bool {
}
// Retorna el nombre de la accion para el paso actual
auto Title::getActionName(int step) -> std::string {
auto Title::getActionName(int step) -> std::string { // NOLINT(readability-convert-member-functions-to-static)
switch (step) {
case 0:
return "LEFT";
@@ -656,7 +656,7 @@ auto Title::getActionName(int step) -> std::string {
}
// Aplica y guarda las teclas redefinidas
void Title::applyKeyboardRemap() {
void Title::applyKeyboardRemap() { // NOLINT(readability-convert-member-functions-to-static)
// Guardar las nuevas teclas en Options::controls
Options::keyboard_controls.key_left = temp_keys_[0];
Options::keyboard_controls.key_right = temp_keys_[1];
@@ -670,7 +670,7 @@ void Title::applyKeyboardRemap() {
}
// Dibuja la pantalla de redefinir teclado
void Title::renderKeyboardRemap() {
void Title::renderKeyboardRemap() const {
// Zona central del menu (debe coincidir con la textura de cheevos)
constexpr int MENU_ZONE_Y = 73;
constexpr int MENU_ZONE_HEIGHT = 102;
@@ -697,17 +697,17 @@ void Title::renderKeyboardRemap() {
const int KEYS_START_Y = START_Y + (2 * LINE_SPACING);
if (remap_step_ > 0) {
const std::string LEFT_KEY = SDL_GetScancodeName(temp_keys_[0]);
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_KEY;
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_KEY; // NOLINT(readability-static-accessed-through-instance)
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, KEYS_START_Y, LEFT_MSG, 1, COLOR);
}
if (remap_step_ > 1) {
const std::string RIGHT_KEY = SDL_GetScancodeName(temp_keys_[1]);
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_KEY;
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_KEY; // NOLINT(readability-static-accessed-through-instance)
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, KEYS_START_Y + LINE_SPACING, RIGHT_MSG, 1, COLOR);
}
if (remap_step_ >= 3) {
const std::string JUMP_KEY = SDL_GetScancodeName(temp_keys_[2]);
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_KEY;
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_KEY; // NOLINT(readability-static-accessed-through-instance)
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, KEYS_START_Y + (2 * LINE_SPACING), JUMP_MSG, 1, COLOR);
}
@@ -718,7 +718,7 @@ void Title::renderKeyboardRemap() {
}
// Dibuja la pantalla de redefinir joystick
void Title::renderJoystickRemap() {
void Title::renderJoystickRemap() const {
// Zona central del menu (debe coincidir con la textura de cheevos)
constexpr int MENU_ZONE_Y = 73;
constexpr int MENU_ZONE_HEIGHT = 102;
@@ -745,17 +745,17 @@ void Title::renderJoystickRemap() {
const int BUTTONS_START_Y = START_Y + (2 * LINE_SPACING);
if (remap_step_ > 0) {
const std::string LEFT_BTN = getButtonName(temp_buttons_[0]);
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_BTN;
const std::string LEFT_MSG = loc->get("title.keys.label0") + LEFT_BTN; // NOLINT(readability-static-accessed-through-instance)
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, BUTTONS_START_Y, LEFT_MSG, 1, COLOR);
}
if (remap_step_ > 1) {
const std::string RIGHT_BTN = getButtonName(temp_buttons_[1]);
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_BTN;
const std::string RIGHT_MSG = loc->get("title.keys.label1") + RIGHT_BTN; // NOLINT(readability-static-accessed-through-instance)
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, BUTTONS_START_Y + LINE_SPACING, RIGHT_MSG, 1, COLOR);
}
if (remap_step_ >= 3) {
const std::string JUMP_BTN = getButtonName(temp_buttons_[2]);
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_BTN;
const std::string JUMP_MSG = loc->get("title.keys.label2") + JUMP_BTN; // NOLINT(readability-static-accessed-through-instance)
menu_text_->writeDX(Text::CENTER_FLAG | Text::COLOR_FLAG, PlayArea::CENTER_X, BUTTONS_START_Y + (2 * LINE_SPACING), JUMP_MSG, 1, COLOR);
}
@@ -827,7 +827,7 @@ void Title::handleJoystickRemap(const SDL_Event& event) {
}
// Valida si un botón está duplicado
auto Title::isButtonDuplicate(int button, int current_step) -> bool {
auto Title::isButtonDuplicate(int button, int current_step) -> bool { // NOLINT(readability-convert-member-functions-to-static)
for (int i = 0; i < current_step; ++i) {
if (temp_buttons_[i] == button) {
return true;
@@ -837,7 +837,7 @@ auto Title::isButtonDuplicate(int button, int current_step) -> bool {
}
// Aplica y guarda los botones del gamepad redefinidos
void Title::applyJoystickRemap() {
void Title::applyJoystickRemap() { // NOLINT(readability-convert-member-functions-to-static)
// Guardar los nuevos botones en Options::gamepad_controls
Options::gamepad_controls.button_left = temp_buttons_[0];
Options::gamepad_controls.button_right = temp_buttons_[1];
@@ -851,7 +851,7 @@ void Title::applyJoystickRemap() {
}
// Retorna el nombre amigable del botón del gamepad
auto Title::getButtonName(int button) -> std::string {
auto Title::getButtonName(int button) -> std::string { // NOLINT(readability-convert-member-functions-to-static)
// Triggers especiales
if (button == Input::TRIGGER_L2_AS_BUTTON) {
return "L2";