clang-tidy
clang-format
This commit is contained in:
2025-08-10 22:01:18 +02:00
parent 659a4ced44
commit 41e3fd1d8d
29 changed files with 235 additions and 302 deletions

View File

@@ -1,8 +1,10 @@
#include "menu_option.h"
#include <algorithm>
#include <algorithm> // Para find
#include <iterator> // Para distance
#include <memory> // Para allocator
#include "text.h"
#include "text.h" // Para Text
auto ActionListOption::getValueAsString() const -> std::string {
if (value_getter_) {

View File

@@ -1,16 +1,15 @@
#pragma once
#include <algorithm> // para std::clamp
#include <functional>
#include <memory>
#include <string>
#include <vector>
#include <algorithm> // Para max, clamp
#include <cstddef> // Para size_t
#include <functional> // Para function
#include <string> // Para allocator, string, basic_string, to_string, operator==, char_traits
#include <utility> // Para move
#include <vector> // Para vector
#include "lang.h" // Para las traducciones
#include "options.h" // Para acceder a las variables de configuración
#include "section.hpp" // Para las acciones como Quit o Reset
#include "text.h" // Para poder calcular el ancho del texto
#include "ui/service_menu.h" // Necesitamos las enums como SettingsGroup
#include "lang.h" // Para getText
#include "text.h" // Para Text
#include "ui/service_menu.h" // Para ServiceMenu
// --- Interfaz Base para todas las Opciones del Menú ---

View File

@@ -404,5 +404,5 @@ auto MenuRenderer::getTruncatedValue(const std::string &value, int available_wid
return truncated;
}
auto MenuRenderer::easeOut(float t) const -> float { return 1.0F - (1.0F - t) * (1.0F - t); }
auto MenuRenderer::easeOut(float t) -> float { return 1.0F - (1.0F - t) * (1.0F - t); }
auto MenuRenderer::shouldShowContent() const -> bool { return !show_hide_animation_.active; }

View File

@@ -124,6 +124,6 @@ class MenuRenderer {
auto setRect(SDL_FRect rect) -> SDL_FRect;
[[nodiscard]] auto getTruncatedValueWidth(const std::string &value, int available_width) const -> int;
[[nodiscard]] auto getTruncatedValue(const std::string &value, int available_width) const -> std::string;
[[nodiscard]] auto easeOut(float t) const -> float;
[[nodiscard]] static auto easeOut(float t) -> float;
[[nodiscard]] auto shouldShowContent() const -> bool;
};

View File

@@ -1,15 +1,14 @@
#include "ui/service_menu.h"
#include <algorithm> // Para max
#include "audio.h" // Para Audio
#include "define_buttons.h" // Para DefineButtons
#include "difficulty.h" // Para getCodeFromName, getNameFromCode
#include "input.h" // Para Input
#include "input_types.h" // Para InputAction
#include "lang.h" // Para getText, getCodeFromName, getNameFromCode
#include "menu_option.h" // Para MenuOption, ListOption, ActionOption, BoolOption, FolderOption, IntOption
#include "menu_option.h" // Para MenuOption, ActionOption, BoolOption, ListOption, FolderOption, IntOption, ActionListOption
#include "menu_renderer.h" // Para MenuRenderer
#include "options.h" // Para PendingChanges, pending_changes, checkPendingChanges, GamepadManager, Video, gamepad_manager, video, Audio, Settings, audio, settings, Gamepad, Window, window, Music, Sound
#include "options.h" // Para GamepadManager, gamepad_manager, PendingChanges, Video, pending_changes, video, Audio, Gamepad, Settings, audio, checkPendingChanges, settings, Window, getPlayerWhoUsesKeyboard, playerIdToString, stringToPlayerId, window, Keyboard, Music, Sound, keyboard
#include "param.h" // Para Param, param, ParamGame, ParamServiceMenu
#include "player.h" // Para Player
#include "resource.h" // Para Resource

View File

@@ -1,14 +1,16 @@
#pragma once
#include <cstddef>
#include <functional>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <SDL3/SDL.h> // Para SDL_Event
#include "define_buttons.h"
#include "ui_message.h"
#include <cstddef> // Para size_t
#include <functional> // Para function
#include <memory> // Para unique_ptr
#include <string> // Para string
#include <utility> // Para pair
#include <vector> // Para vector
#include "define_buttons.h" // Para DefineButtons
#include "ui_message.h" // Para UIMessage
class MenuOption;
class MenuRenderer;

View File

@@ -1,13 +1,14 @@
#pragma once
#include <SDL3/SDL.h>
#include <SDL3/SDL.h> // Para SDL_FPoint, SDL_FRect
#include <memory>
#include <string>
#include <vector>
#include <algorithm> // Para min
#include <memory> // Para allocator, shared_ptr
#include <string> // Para string
#include <vector> // Para vector
#include "color.h"
#include "text.h"
#include "color.h" // Para Color
#include "text.h" // Para Text
class WindowMessage {
public:
@@ -24,21 +25,21 @@ class WindowMessage {
Color text_color;
// Espaciado y dimensiones
float padding{15.0f};
float line_spacing{5.0f};
float title_separator_spacing{10.0f}; // Espacio extra para separador del título
float padding{15.0F};
float line_spacing{5.0F};
float title_separator_spacing{10.0F}; // Espacio extra para separador del título
// Límites de tamaño
float min_width{200.0f};
float min_height{100.0f};
float max_width_ratio{0.8f}; // % máximo de ancho de pantalla
float max_height_ratio{0.8f}; // % máximo de alto de pantalla
float min_width{200.0F};
float min_height{100.0F};
float max_width_ratio{0.8F}; // % máximo de ancho de pantalla
float max_height_ratio{0.8F}; // % máximo de alto de pantalla
// Margen de seguridad para texto
float text_safety_margin{20.0f}; // Margen extra para evitar texto cortado
float text_safety_margin{20.0F}; // Margen extra para evitar texto cortado
// Animaciones
float animation_duration{0.3f}; // Duración en segundos para todas las animaciones
float animation_duration{0.3F}; // Duración en segundos para todas las animaciones
// Constructor con valores por defecto
Config()
@@ -123,7 +124,7 @@ class WindowMessage {
// Posición y tamaño
SDL_FRect rect_{0, 0, 300, 200};
PositionMode position_mode_ = PositionMode::CENTERED;
SDL_FPoint anchor_{0.0f, 0.0f};
SDL_FPoint anchor_{0.0F, 0.0F};
// Animación de redimensionado
struct ResizeAnimation {