clang-tidy

This commit is contained in:
2026-04-07 12:06:41 +02:00
parent 39170a086e
commit 5462b31f96
12 changed files with 63 additions and 64 deletions

View File

@@ -12,39 +12,39 @@ auto Color::fromString(const std::string& name) -> Uint8 {
// Incluye nombres oficiales del CPC y aliases para compatibilidad
static const std::unordered_map<std::string, Uint8> COLOR_MAP = {
// Transparente
{"transparent", index(Cpc::CLEAR)},
{"transparent", getIndex(Cpc::CLEAR)},
// Colores oficiales Amstrad CPC
{"black", index(Cpc::BLACK)},
{"blue", index(Cpc::BLUE)},
{"bright_blue", index(Cpc::BRIGHT_BLUE)},
{"red", index(Cpc::RED)},
{"magenta", index(Cpc::MAGENTA)},
{"mauve", index(Cpc::MAUVE)},
{"bright_red", index(Cpc::BRIGHT_RED)},
{"purple", index(Cpc::PURPLE)},
{"bright_magenta", index(Cpc::BRIGHT_MAGENTA)},
{"green", index(Cpc::GREEN)},
{"cyan", index(Cpc::CYAN)},
{"sky_blue", index(Cpc::SKY_BLUE)},
{"yellow", index(Cpc::YELLOW)},
{"white", index(Cpc::WHITE)},
{"pastel_blue", index(Cpc::PASTEL_BLUE)},
{"orange", index(Cpc::ORANGE)},
{"pink", index(Cpc::PINK)},
{"pastel_magenta", index(Cpc::PASTEL_MAGENTA)},
{"bright_green", index(Cpc::BRIGHT_GREEN)},
{"sea_green", index(Cpc::SEA_GREEN)},
{"bright_cyan", index(Cpc::BRIGHT_CYAN)},
{"lime", index(Cpc::LIME)},
{"pastel_green", index(Cpc::PASTEL_GREEN)},
{"pastel_cyan", index(Cpc::PASTEL_CYAN)},
{"bright_yellow", index(Cpc::BRIGHT_YELLOW)},
{"pastel_yellow", index(Cpc::PASTEL_YELLOW)},
{"bright_white", index(Cpc::BRIGHT_WHITE)},
{"black", getIndex(Cpc::BLACK)},
{"blue", getIndex(Cpc::BLUE)},
{"bright_blue", getIndex(Cpc::BRIGHT_BLUE)},
{"red", getIndex(Cpc::RED)},
{"magenta", getIndex(Cpc::MAGENTA)},
{"mauve", getIndex(Cpc::MAUVE)},
{"bright_red", getIndex(Cpc::BRIGHT_RED)},
{"purple", getIndex(Cpc::PURPLE)},
{"bright_magenta", getIndex(Cpc::BRIGHT_MAGENTA)},
{"green", getIndex(Cpc::GREEN)},
{"cyan", getIndex(Cpc::CYAN)},
{"sky_blue", getIndex(Cpc::SKY_BLUE)},
{"yellow", getIndex(Cpc::YELLOW)},
{"white", getIndex(Cpc::WHITE)},
{"pastel_blue", getIndex(Cpc::PASTEL_BLUE)},
{"orange", getIndex(Cpc::ORANGE)},
{"pink", getIndex(Cpc::PINK)},
{"pastel_magenta", getIndex(Cpc::PASTEL_MAGENTA)},
{"bright_green", getIndex(Cpc::BRIGHT_GREEN)},
{"sea_green", getIndex(Cpc::SEA_GREEN)},
{"bright_cyan", getIndex(Cpc::BRIGHT_CYAN)},
{"lime", getIndex(Cpc::LIME)},
{"pastel_green", getIndex(Cpc::PASTEL_GREEN)},
{"pastel_cyan", getIndex(Cpc::PASTEL_CYAN)},
{"bright_yellow", getIndex(Cpc::BRIGHT_YELLOW)},
{"pastel_yellow", getIndex(Cpc::PASTEL_YELLOW)},
{"bright_white", getIndex(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", getIndex(Cpc::BLACK)}, // No existe en CPC, mapea a negro
};
auto it = COLOR_MAP.find(name);
@@ -53,5 +53,5 @@ auto Color::fromString(const std::string& name) -> Uint8 {
}
// Si no se encuentra, devuelve negro por defecto
return index(Cpc::BLACK);
return getIndex(Cpc::BLACK);
}

View File

@@ -78,7 +78,7 @@ class Color {
* @param color Color del enum Cpc
* @return Índice de paleta (Uint8)
*/
static constexpr auto index(Cpc color) -> Uint8 {
static constexpr auto getIndex(Cpc color) -> Uint8 { // NOLINT(readability-identifier-naming)
return static_cast<Uint8>(color);
}

View File

@@ -26,11 +26,11 @@ struct Rgb {
};
// 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 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
// CONVERSIONES DE TIPOS SDL
auto toSDLRect(const SDL_FRect& frect) -> SDL_Rect; // Convierte SDL_FRect a SDL_Rect
auto toSDLPoint(const SDL_FPoint& fpoint) -> SDL_Point; // Convierte SDL_FPoint a SDL_Point