clang-format

This commit is contained in:
2025-11-23 12:26:42 +01:00
parent 3d2ad5f292
commit cb26e7194c
18 changed files with 126 additions and 127 deletions

View File

@@ -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);

View File

@@ -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<Uint8>(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<Uint8>(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

View File

@@ -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

View File

@@ -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)