#pragma once #include #include // Para string #include // Para vector // Estructura para definir un circulo struct Circle { int x{0}; int y{0}; int r{0}; }; // Estructura para definir una linea horizontal struct LineHorizontal { int x1{0}, x2{0}, y{0}; }; // Estructura para definir una linea vertical struct LineVertical { int x{0}, y1{0}, y2{0}; }; // Estructura para definir una linea struct Line { int x1{0}, y1{0}, x2{0}, y2{0}; }; // Estructura para definir un color RGB struct ColorRGB { Uint8 r{0}; Uint8 g{0}; Uint8 b{0}; // Constructor ColorRGB(Uint8 red, Uint8 green, Uint8 blue) : r(red), g(green), b(blue) {} }; // 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 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) // 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 // CONVERSIONES DE STRING auto stringToColor(const std::string& str) -> Uint8; // String a índice de paleta auto safeStoi(const std::string& value, int default_value = 0) -> int; // String a int seguro (sin excepciones) auto stringToBool(const std::string& str) -> bool; // String a bool (true/1/yes/on) auto boolToString(bool value) -> std::string; // Bool a string (1/0) auto toLower(const std::string& str) -> std::string; // String a minúsculas auto toUpper(const std::string& str) -> std::string; // String a mayúsculas // OPERACIONES CON STRINGS auto stringInVector(const std::vector& vec, const std::string& str) -> bool; // Busca string en vector auto spaceBetweenLetters(const std::string& input) -> std::string; // Añade espacios entre letras // OPERACIONES CON COLORES auto colorAreEqual(ColorRGB color1, ColorRGB color2) -> bool; // Compara dos colores RGB // OPERACIONES CON FICHEROS auto getFileName(const std::string& path) -> std::string; // Extrae nombre de fichero de ruta auto getPath(const std::string& full_path) -> std::string; // Extrae directorio de ruta completa // RENDERIZADO void fillTextureWithColor(SDL_Renderer* renderer, SDL_Texture* texture, Uint8 r, Uint8 g, Uint8 b, Uint8 a); // Rellena textura // OUTPUT Y UTILIDADES DE CONSOLA void printWithDots(const std::string& text1, const std::string& text2, const std::string& text3, size_t width); // Imprime línea con puntos