From cb26e7194c00b565233aa2449c3ecac820a296de Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sun, 23 Nov 2025 12:26:42 +0100 Subject: [PATCH] clang-format --- source/core/rendering/screen.cpp | 2 +- source/core/rendering/screen.hpp | 8 +- source/core/system/debug.cpp | 2 +- source/game/defaults.hpp | 12 +-- source/game/entities/player.cpp | 4 +- source/game/entities/player.hpp | 17 ++-- source/game/gameplay/collision_map.hpp | 6 +- source/game/gameplay/room.cpp | 6 +- source/game/gameplay/room.hpp | 36 +++---- source/game/options.hpp | 4 +- source/game/scenes/game.cpp | 4 +- source/game/scenes/logo.cpp | 2 +- source/game/scenes/title.cpp | 4 +- source/game/ui/notifier.cpp | 2 +- source/utils/color.cpp | 2 +- source/utils/color.hpp | 124 ++++++++++++------------- source/utils/defines.hpp | 4 +- source/utils/utils.hpp | 14 +-- 18 files changed, 126 insertions(+), 127 deletions(-) diff --git a/source/core/rendering/screen.cpp b/source/core/rendering/screen.cpp index 3f98b68..1d8a8b1 100644 --- a/source/core/rendering/screen.cpp +++ b/source/core/rendering/screen.cpp @@ -332,7 +332,7 @@ void Screen::textureToRenderer() { void Screen::renderOverlays() { renderNotifications(); #ifdef _DEBUG - //renderInfo(); + // renderInfo(); #endif } diff --git a/source/core/rendering/screen.hpp b/source/core/rendering/screen.hpp index 6661e05..bc8524d 100644 --- a/source/core/rendering/screen.hpp +++ b/source/core/rendering/screen.hpp @@ -29,10 +29,10 @@ class Screen { // Renderizado void clearRenderer(ColorRGB color = {0x00, 0x00, 0x00}); // Limpia el renderer - void clearSurface(Uint8 index); // Limpia la game_surface_ - void start(); // Prepara para empezar a dibujar en la textura de juego - void render(); // Vuelca el contenido del renderizador en pantalla - void update(float delta_time); // Actualiza la lógica de la clase + void clearSurface(Uint8 index); // Limpia la game_surface_ + void start(); // Prepara para empezar a dibujar en la textura de juego + void render(); // Vuelca el contenido del renderizador en pantalla + void update(float delta_time); // Actualiza la lógica de la clase // Video y ventana void setVideoMode(bool mode); // Establece el modo de video diff --git a/source/core/system/debug.cpp b/source/core/system/debug.cpp index ed261d0..a64501e 100644 --- a/source/core/system/debug.cpp +++ b/source/core/system/debug.cpp @@ -7,8 +7,8 @@ #include "core/rendering/text.hpp" // Para Text #include "core/resources/resource_cache.hpp" // Para Resource -#include "utils/defines.hpp" // Para PlayArea #include "utils/color.hpp" // Para Color +#include "utils/defines.hpp" // Para PlayArea // [SINGLETON] Debug* Debug::debug = nullptr; diff --git a/source/game/defaults.hpp b/source/game/defaults.hpp index bea4d85..e19b6bf 100644 --- a/source/game/defaults.hpp +++ b/source/game/defaults.hpp @@ -51,17 +51,17 @@ constexpr bool ENABLED = true; // Audio por defecto // --- MUSIC --- namespace Music { -constexpr float VOLUME = 0.8F; // Volumen por defecto de la musica -constexpr bool ENABLED = true; // Musica habilitada por defecto +constexpr float VOLUME = 0.8F; // Volumen por defecto de la musica +constexpr bool ENABLED = true; // Musica habilitada por defecto constexpr const char* TITLE_TRACK = "574070_KUVO_Farewell_to_school.ogg"; // Musica de la escena title -constexpr const char* GAME_TRACK = "574071_EA_DTV.ogg"; // Musica de la escena game -constexpr int FADE_DURATION_MS = 1000; // Duracion del fade out en milisegundos +constexpr const char* GAME_TRACK = "574071_EA_DTV.ogg"; // Musica de la escena game +constexpr int FADE_DURATION_MS = 1000; // Duracion del fade out en milisegundos } // namespace Music // --- SOUND --- namespace Sound { -constexpr float VOLUME = 1.0F; // Volumen por defecto de los efectos de sonido -constexpr bool ENABLED = true; // Sonido habilitado por defecto +constexpr float VOLUME = 1.0F; // Volumen por defecto de los efectos de sonido +constexpr bool ENABLED = true; // Sonido habilitado por defecto constexpr const char* JUMP = "jump.wav"; // Sonido de salto constexpr const char* HIT = "hit.wav"; // Sonido de golpe/daño constexpr const char* LAND = "land.wav"; // Sonido de aterrizaje diff --git a/source/game/entities/player.cpp b/source/game/entities/player.cpp index aa25172..6735a90 100644 --- a/source/game/entities/player.cpp +++ b/source/game/entities/player.cpp @@ -6,8 +6,8 @@ #include #include // Para std::ranges::any_of -#include "core/audio/audio.hpp" // Para Audio -#include "core/input/input.hpp" // Para Input, InputAction +#include "core/audio/audio.hpp" // Para Audio +#include "core/input/input.hpp" // Para Input, InputAction #include "core/rendering/surface_animated_sprite.hpp" // Para SAnimatedSprite #include "core/resources/resource_cache.hpp" // Para Resource #include "game/defaults.hpp" // Para Defaults::Sound diff --git a/source/game/entities/player.hpp b/source/game/entities/player.hpp index 84c7e7b..f7c7e27 100644 --- a/source/game/entities/player.hpp +++ b/source/game/entities/player.hpp @@ -30,7 +30,6 @@ class Player { NONE }; - struct SpawnData { float x = 0; float y = 0; @@ -85,8 +84,8 @@ class Player { static constexpr float HORIZONTAL_DECELERATION = 250.0F; // Desaceleración al soltar (momentum) en pixels/segundo² // --- Constantes de salto --- - static constexpr float JUMP_VELOCITY = -160.0F; // Impulso de salto en pixels/segundo (más fuerte, menos floaty) - static constexpr float GRAVITY_FORCE = 280.0F; // Gravedad en pixels/segundo² (más alta, menos floaty) + static constexpr float JUMP_VELOCITY = -160.0F; // Impulso de salto en pixels/segundo (más fuerte, menos floaty) + static constexpr float GRAVITY_FORCE = 280.0F; // Gravedad en pixels/segundo² (más alta, menos floaty) // --- Objetos y punteros --- std::shared_ptr room_; // Objeto encargado de gestionar cada habitación del juego @@ -110,8 +109,8 @@ class Player { // --- Variables de colisión --- SDL_FRect collider_box_{}; // Caja de colisión con los enemigos u objetos std::array collider_points_{}; // Puntos de colisión con el mapa - SDL_FPoint under_left_foot_ = {0.0F, 0.0F}; // El punto bajo la esquina inferior izquierda del jugador - SDL_FPoint under_right_foot_ = {0.0F, 0.0F}; // El punto bajo la esquina inferior derecha del jugador + SDL_FPoint under_left_foot_ = {0.0F, 0.0F}; // El punto bajo la esquina inferior izquierda del jugador + SDL_FPoint under_right_foot_ = {0.0F, 0.0F}; // El punto bajo la esquina inferior derecha del jugador // --- Variables de juego --- bool is_alive_ = true; // Indica si el jugador esta vivo o no @@ -166,9 +165,9 @@ class Player { void placeSprite(); // Coloca el sprite en la posición del jugador // --- Funciones de finalización --- - void animate(float delta_time); // Establece la animación del jugador - auto handleBorders() -> Room::Border; // Comprueba si se halla en alguno de los cuatro bordes - auto handleKillingTiles() -> bool; // Comprueba que el jugador no toque ningun tile de los que matan + void animate(float delta_time); // Establece la animación del jugador + auto handleBorders() -> Room::Border; // Comprueba si se halla en alguno de los cuatro bordes + auto handleKillingTiles() -> bool; // Comprueba que el jugador no toque ningun tile de los que matan void updateVelocity(float delta_time); // Calcula la velocidad en x con aceleración - void markAsDead(); // Marca al jugador como muerto + void markAsDead(); // Marca al jugador como muerto }; \ No newline at end of file diff --git a/source/game/gameplay/collision_map.hpp b/source/game/gameplay/collision_map.hpp index 1cb389b..b6b6211 100644 --- a/source/game/gameplay/collision_map.hpp +++ b/source/game/gameplay/collision_map.hpp @@ -71,9 +71,9 @@ class CollisionMap { private: // --- Constantes (usar defines de PlayArea) --- - static constexpr int TILE_SIZE = ::Tile::SIZE; // Tamaño del tile en pixels - static constexpr int MAP_WIDTH = PlayArea::TILE_COLS; // Ancho del mapa en tiles - static constexpr int MAP_HEIGHT = PlayArea::TILE_ROWS; // Alto del mapa en tiles + static constexpr int TILE_SIZE = ::Tile::SIZE; // Tamaño del tile en pixels + static constexpr int MAP_WIDTH = PlayArea::TILE_COLS; // Ancho del mapa en tiles + static constexpr int MAP_HEIGHT = PlayArea::TILE_ROWS; // Alto del mapa en tiles // --- Datos de la habitación --- std::vector tile_map_; // Índices de colisión de la habitación diff --git a/source/game/gameplay/room.cpp b/source/game/gameplay/room.cpp index b40b44b..ef1a307 100644 --- a/source/game/gameplay/room.cpp +++ b/source/game/gameplay/room.cpp @@ -54,7 +54,7 @@ void Room::initializeRoom(const Data& room) { right_room_ = room.right_room; tile_set_file_ = room.tile_set_file; conveyor_belt_direction_ = room.conveyor_belt_direction; - tile_map_ = room.tile_map; // Tilemap para renderizado (viene embebido en el YAML) + tile_map_ = room.tile_map; // Tilemap para renderizado (viene embebido en el YAML) collision_data_ = room.collision_map; // Collisionmap para colisiones (viene embebido en el YAML) surface_ = Resource::Cache::get()->getSurface(room.tile_set_file); tile_set_width_ = surface_->getWidth() / TILE_SIZE; @@ -93,11 +93,11 @@ void Room::openTheJail() { constexpr int TILE_A = 16 + (13 * MAP_WIDTH); constexpr int TILE_B = 16 + (14 * MAP_WIDTH); if (TILE_A < tile_map_.size()) { - tile_map_[TILE_A] = -1; // Renderizado: vacío + tile_map_[TILE_A] = -1; // Renderizado: vacío collision_data_[TILE_A] = -1; // Colisiones: vacío } if (TILE_B < tile_map_.size()) { - tile_map_[TILE_B] = -1; // Renderizado: vacío + tile_map_[TILE_B] = -1; // Renderizado: vacío collision_data_[TILE_B] = -1; // Colisiones: vacío } } diff --git a/source/game/gameplay/room.hpp b/source/game/gameplay/room.hpp index 2cc58d7..42039ec 100644 --- a/source/game/gameplay/room.hpp +++ b/source/game/gameplay/room.hpp @@ -92,9 +92,9 @@ class Room { private: // Constantes (usar defines de PlayArea) - static constexpr int TILE_SIZE = ::Tile::SIZE; // Ancho del tile en pixels - static constexpr int MAP_WIDTH = PlayArea::TILE_COLS; // Ancho del mapa en tiles - static constexpr int MAP_HEIGHT = PlayArea::TILE_ROWS; // Alto del mapa en tiles + static constexpr int TILE_SIZE = ::Tile::SIZE; // Ancho del tile en pixels + static constexpr int MAP_WIDTH = PlayArea::TILE_COLS; // Ancho del mapa en tiles + static constexpr int MAP_HEIGHT = PlayArea::TILE_ROWS; // Alto del mapa en tiles // Objetos y punteros std::unique_ptr enemy_manager_; // Gestor de enemigos de la habitación @@ -105,22 +105,22 @@ class Room { std::shared_ptr data_; // Puntero a los datos del marcador // --- Variables --- - std::string number_; // Numero de la habitación - std::string name_; // Nombre de la habitación - std::string bg_color_; // Color de fondo de la habitación - std::string border_color_; // Color del borde de la pantalla - std::string item_color1_; // Color 1 para los items de la habitación - std::string item_color2_; // Color 2 para los items de la habitación - std::string upper_room_; // Identificador de la habitación que se encuentra arriba - std::string lower_room_; // Identificador de la habitación que se encuentra abajp - std::string left_room_; // Identificador de la habitación que se encuentra a la izquierda - std::string right_room_; // Identificador de la habitación que se encuentra a la derecha - std::string tile_set_file_; // Imagen con los graficos para la habitación - std::vector tile_map_; // Indice de los tiles a dibujar en la habitación (embebido desde YAML) + std::string number_; // Numero de la habitación + std::string name_; // Nombre de la habitación + std::string bg_color_; // Color de fondo de la habitación + std::string border_color_; // Color del borde de la pantalla + std::string item_color1_; // Color 1 para los items de la habitación + std::string item_color2_; // Color 2 para los items de la habitación + std::string upper_room_; // Identificador de la habitación que se encuentra arriba + std::string lower_room_; // Identificador de la habitación que se encuentra abajp + std::string left_room_; // Identificador de la habitación que se encuentra a la izquierda + std::string right_room_; // Identificador de la habitación que se encuentra a la derecha + std::string tile_set_file_; // Imagen con los graficos para la habitación + std::vector tile_map_; // Indice de los tiles a dibujar en la habitación (embebido desde YAML) std::vector collision_data_; // Indice de colisiones de la habitación (embebido desde YAML) - int conveyor_belt_direction_{0}; // Sentido en el que arrastran las superficies automáticas de la habitación - bool is_paused_{false}; // Indica si el mapa esta en modo pausa - int tile_set_width_{0}; // Ancho del tileset en tiles + int conveyor_belt_direction_{0}; // Sentido en el que arrastran las superficies automáticas de la habitación + bool is_paused_{false}; // Indica si el mapa esta en modo pausa + int tile_set_width_{0}; // Ancho del tileset en tiles // --- Funciones --- void initializeRoom(const Data& room); // Inicializa los valores diff --git a/source/game/options.hpp b/source/game/options.hpp index 19b30f8..89b085d 100644 --- a/source/game/options.hpp +++ b/source/game/options.hpp @@ -50,8 +50,8 @@ struct Cheat { // Estructura con opciones de la ventana struct Window { std::string caption{std::format("{} v{} ({})", Project::LONG_NAME, Project::VERSION, Project::COPYRIGHT)}; // Texto que aparece en la barra de título de la ventana - int zoom{Defaults::Window::ZOOM}; // Zoom de la ventana - int max_zoom{Defaults::Window::ZOOM}; // Máximo tamaño de zoom para la ventana + int zoom{Defaults::Window::ZOOM}; // Zoom de la ventana + int max_zoom{Defaults::Window::ZOOM}; // Máximo tamaño de zoom para la ventana }; // Estructura para gestionar el borde de la pantalla diff --git a/source/game/scenes/game.cpp b/source/game/scenes/game.cpp index c7bb5ed..66328ab 100644 --- a/source/game/scenes/game.cpp +++ b/source/game/scenes/game.cpp @@ -15,16 +15,16 @@ #include "core/resources/resource_cache.hpp" // Para ResourceRoom, Resource #include "core/resources/resource_list.hpp" // Para Asset #include "core/system/global_events.hpp" // Para check +#include "game/defaults.hpp" // Para Defaults::Music #include "game/gameplay/item_tracker.hpp" // Para ItemTracker #include "game/gameplay/room.hpp" // Para Room, RoomData #include "game/gameplay/room_tracker.hpp" // Para RoomTracker #include "game/gameplay/scoreboard.hpp" // Para Scoreboard::Data, Scoreboard -#include "game/defaults.hpp" // Para Defaults::Music #include "game/options.hpp" // Para Options, options, Cheat, SectionState #include "game/scene_manager.hpp" // Para SceneManager #include "game/ui/notifier.hpp" // Para Notifier, NotificationText, CHEEVO_NO... -#include "utils/defines.hpp" // Para Tile::SIZE, PlayArea::HEIGHT, RoomBorder::BOTTOM #include "utils/color.hpp" // Para Color +#include "utils/defines.hpp" // Para Tile::SIZE, PlayArea::HEIGHT, RoomBorder::BOTTOM #include "utils/utils.hpp" // Para stringToColor #ifdef _DEBUG diff --git a/source/game/scenes/logo.cpp b/source/game/scenes/logo.cpp index 974f872..56da34f 100644 --- a/source/game/scenes/logo.cpp +++ b/source/game/scenes/logo.cpp @@ -16,10 +16,10 @@ #include "core/system/global_events.hpp" // Para check #include "game/options.hpp" // Para Options, SectionState, options, Section #include "game/scene_manager.hpp" // Para SceneManager +#include "utils/color.hpp" // Para Color #include "utils/defines.hpp" // Para GameCanvas #include "utils/delta_timer.hpp" // Para DeltaTimer #include "utils/easing_functions.hpp" // Para funciones de suavizado -#include "utils/color.hpp" // Para Color // Constructor Logo::Logo() diff --git a/source/game/scenes/title.cpp b/source/game/scenes/title.cpp index 1f8a1a5..0b4fc18 100644 --- a/source/game/scenes/title.cpp +++ b/source/game/scenes/title.cpp @@ -17,8 +17,8 @@ #include "game/defaults.hpp" // Para Defaults::Music #include "game/options.hpp" // Para Options, options, SectionState, Section #include "game/scene_manager.hpp" // Para SceneManager -#include "utils/defines.hpp" // Para GameCanvas::CENTER_X, GameCanvas::WIDTH #include "utils/color.hpp" // Para Color +#include "utils/defines.hpp" // Para GameCanvas::CENTER_X, GameCanvas::WIDTH #include "utils/utils.hpp" // Para stringToColor // Constructor @@ -46,7 +46,7 @@ Title::Title() // Acciones iniciales Screen::get()->setBorderColor(Color::index(Color::Cpc::BLACK)); // Cambia el color del borde - Audio::get()->playMusic(Defaults::Music::TITLE_TRACK); // Inicia la musica + Audio::get()->playMusic(Defaults::Music::TITLE_TRACK); // Inicia la musica } // Comprueba el manejador de eventos diff --git a/source/game/ui/notifier.cpp b/source/game/ui/notifier.cpp index eaa44af..2c61ad6 100644 --- a/source/game/ui/notifier.cpp +++ b/source/game/ui/notifier.cpp @@ -15,8 +15,8 @@ #include "core/rendering/text.hpp" // Para Text, Text::CENTER_FLAG, Text::COLOR_FLAG #include "core/resources/resource_cache.hpp" // Para Resource #include "game/options.hpp" // Para Options, options, NotificationPosition -#include "utils/delta_timer.hpp" // Para DeltaTimer #include "utils/color.hpp" // Para Color +#include "utils/delta_timer.hpp" // Para DeltaTimer // [SINGLETON] Notifier* Notifier::notifier = nullptr; diff --git a/source/utils/color.cpp b/source/utils/color.cpp index af7614f..52165cf 100644 --- a/source/utils/color.cpp +++ b/source/utils/color.cpp @@ -44,7 +44,7 @@ auto Color::fromString(const std::string& name) -> Uint8 { {"bright_white", index(Cpc::BRIGHT_WHITE)}, // Aliases para compatibilidad con archivos YAML existentes (Spectrum) - {"bright_black", index(Cpc::BLACK)}, // No existe en CPC, mapea a negro + {"bright_black", index(Cpc::BLACK)}, // No existe en CPC, mapea a negro }; auto it = COLOR_MAP.find(name); diff --git a/source/utils/color.hpp b/source/utils/color.hpp index 3a8d5b8..184de6c 100644 --- a/source/utils/color.hpp +++ b/source/utils/color.hpp @@ -18,77 +18,77 @@ * de 3 niveles de intensidad (0, 128, 255) para cada componente RGB. */ class Color { - public: - /** - * @enum Cpc - * @brief Índices de los colores de la paleta Amstrad CPC - * - * Los nombres corresponden a los colores oficiales documentados por Amstrad. - * El índice 0 está reservado para transparencia. - */ - enum class Cpc : Uint8 { - // Transparente (índice 0) - CLEAR = 0, // Nota: No usar "TRANSPARENT" - colisiona con macro de Windows + public: + /** + * @enum Cpc + * @brief Índices de los colores de la paleta Amstrad CPC + * + * Los nombres corresponden a los colores oficiales documentados por Amstrad. + * El índice 0 está reservado para transparencia. + */ + enum class Cpc : Uint8 { + // Transparente (índice 0) + CLEAR = 0, // Nota: No usar "TRANSPARENT" - colisiona con macro de Windows - // Negros y azules (R=0) - BLACK = 1, // 0, 0, 0 - BLUE = 2, // 0, 0, 128 - BRIGHT_BLUE = 3, // 0, 0, 255 + // Negros y azules (R=0) + BLACK = 1, // 0, 0, 0 + BLUE = 2, // 0, 0, 128 + BRIGHT_BLUE = 3, // 0, 0, 255 - // Rojos y magentas (G=0) - RED = 4, // 128, 0, 0 - MAGENTA = 5, // 128, 0, 128 - MAUVE = 6, // 128, 0, 255 - BRIGHT_RED = 7, // 255, 0, 0 - PURPLE = 8, // 255, 0, 128 - BRIGHT_MAGENTA = 9, // 255, 0, 255 + // Rojos y magentas (G=0) + RED = 4, // 128, 0, 0 + MAGENTA = 5, // 128, 0, 128 + MAUVE = 6, // 128, 0, 255 + BRIGHT_RED = 7, // 255, 0, 0 + PURPLE = 8, // 255, 0, 128 + BRIGHT_MAGENTA = 9, // 255, 0, 255 - // Verdes y cianes (R=0, G>0) - GREEN = 10, // 0, 128, 0 - CYAN = 11, // 0, 128, 128 - SKY_BLUE = 12, // 0, 128, 255 + // Verdes y cianes (R=0, G>0) + GREEN = 10, // 0, 128, 0 + CYAN = 11, // 0, 128, 128 + SKY_BLUE = 12, // 0, 128, 255 - // Amarillos y blancos medios (G=128) - YELLOW = 13, // 128, 128, 0 - WHITE = 14, // 128, 128, 128 - PASTEL_BLUE = 15, // 128, 128, 255 + // Amarillos y blancos medios (G=128) + YELLOW = 13, // 128, 128, 0 + WHITE = 14, // 128, 128, 128 + PASTEL_BLUE = 15, // 128, 128, 255 - // Naranjas y rosas (R=255, G=128) - ORANGE = 16, // 255, 128, 0 - PINK = 17, // 255, 128, 128 - PASTEL_MAGENTA = 18, // 255, 128, 255 + // Naranjas y rosas (R=255, G=128) + ORANGE = 16, // 255, 128, 0 + PINK = 17, // 255, 128, 128 + PASTEL_MAGENTA = 18, // 255, 128, 255 - // Verdes brillantes (G=255) - BRIGHT_GREEN = 19, // 0, 255, 0 - SEA_GREEN = 20, // 0, 255, 128 - BRIGHT_CYAN = 21, // 0, 255, 255 + // Verdes brillantes (G=255) + BRIGHT_GREEN = 19, // 0, 255, 0 + SEA_GREEN = 20, // 0, 255, 128 + BRIGHT_CYAN = 21, // 0, 255, 255 - // Limas y pasteles verdes (G=255) - LIME = 22, // 128, 255, 0 - PASTEL_GREEN = 23, // 128, 255, 128 - PASTEL_CYAN = 24, // 128, 255, 255 + // Limas y pasteles verdes (G=255) + LIME = 22, // 128, 255, 0 + PASTEL_GREEN = 23, // 128, 255, 128 + PASTEL_CYAN = 24, // 128, 255, 255 - // Amarillos brillantes y blancos (R=255, G=255) - BRIGHT_YELLOW = 25, // 255, 255, 0 - PASTEL_YELLOW = 26, // 255, 255, 128 - BRIGHT_WHITE = 27 // 255, 255, 255 - }; + // Amarillos brillantes y blancos (R=255, G=255) + BRIGHT_YELLOW = 25, // 255, 255, 0 + PASTEL_YELLOW = 26, // 255, 255, 128 + BRIGHT_WHITE = 27 // 255, 255, 255 + }; - /** - * @brief Obtiene el índice de paleta de un color CPC - * @param color Color del enum Cpc - * @return Índice de paleta (Uint8) - */ - static constexpr auto index(Cpc color) -> Uint8 { - return static_cast(color); - } + /** + * @brief Obtiene el índice de paleta de un color CPC + * @param color Color del enum Cpc + * @return Índice de paleta (Uint8) + */ + static constexpr auto index(Cpc color) -> Uint8 { + return static_cast(color); + } - /** - * @brief Convierte un nombre de color (string) a índice de paleta - * @param name Nombre del color en minúsculas (ej: "cyan", "bright_blue") - * @return Índice de paleta, o 1 (BLACK) si no se encuentra - */ - static auto fromString(const std::string& name) -> Uint8; + /** + * @brief Convierte un nombre de color (string) a índice de paleta + * @param name Nombre del color en minúsculas (ej: "cyan", "bright_blue") + * @return Índice de paleta, o 1 (BLACK) si no se encuentra + */ + static auto fromString(const std::string& name) -> Uint8; }; -#endif // COLOR_HPP +#endif // COLOR_HPP diff --git a/source/utils/defines.hpp b/source/utils/defines.hpp index 67ef48e..f73c008 100644 --- a/source/utils/defines.hpp +++ b/source/utils/defines.hpp @@ -25,8 +25,8 @@ constexpr int X = 0; constexpr int Y = 0; // Dimensiones en tiles -constexpr int TILE_COLS = 40; // Ancho del mapa en tiles -constexpr int TILE_ROWS = 24; // Alto del mapa en tiles +constexpr int TILE_COLS = 40; // Ancho del mapa en tiles +constexpr int TILE_ROWS = 24; // Alto del mapa en tiles constexpr int TILE_COUNT = TILE_COLS * TILE_ROWS; // 960 tiles totales // Dimensiones en pixels diff --git a/source/utils/utils.hpp b/source/utils/utils.hpp index f29780f..d48d2e8 100644 --- a/source/utils/utils.hpp +++ b/source/utils/utils.hpp @@ -41,13 +41,13 @@ struct ColorRGB { }; // COLISIONES Y GEOMETRÍA -auto distanceSquared(int x1, int y1, int x2, int y2) -> double; // Distancia² entre dos puntos -auto checkCollision(const Circle& a, const Circle& b) -> bool; // Colisión círculo-círculo -auto checkCollision(const Circle& a, const SDL_FRect& rect) -> bool; // Colisión círculo-rectángulo -auto checkCollision(const SDL_FRect& a, const SDL_FRect& b) -> bool; // Colisión rectángulo-rectángulo -auto checkCollision(const SDL_FPoint& p, const SDL_FRect& r) -> bool; // Colisión punto-rectángulo -auto checkCollision(const LineHorizontal& l, const SDL_FRect& r) -> bool; // Colisión línea horizontal-rectángulo -auto checkCollision(const LineVertical& l, const SDL_FRect& r) -> bool; // Colisión línea vertical-rectángulo +auto distanceSquared(int x1, int y1, int x2, int y2) -> double; // Distancia² entre dos puntos +auto checkCollision(const Circle& a, const Circle& b) -> bool; // Colisión círculo-círculo +auto checkCollision(const Circle& a, const SDL_FRect& rect) -> bool; // Colisión círculo-rectángulo +auto checkCollision(const SDL_FRect& a, const SDL_FRect& b) -> bool; // Colisión rectángulo-rectángulo +auto checkCollision(const SDL_FPoint& p, const SDL_FRect& r) -> bool; // Colisión punto-rectángulo +auto checkCollision(const LineHorizontal& l, const SDL_FRect& r) -> bool; // Colisión línea horizontal-rectángulo +auto checkCollision(const LineVertical& l, const SDL_FRect& r) -> bool; // Colisión línea vertical-rectángulo auto checkCollision(const LineHorizontal& l, const SDL_FPoint& p) -> bool; // Colisión línea horizontal-punto auto checkCollision(const Line& l1, const Line& l2) -> SDL_Point; // Colisión línea-línea (intersección)