#pragma once #include #include "ltexture.h" #include #ifndef UTILS_H #define UTILS_H // Estructura para definir un circulo struct circle_t { int x; int y; int r; }; // Estructura para definir un color struct color_t { Uint8 r; Uint8 g; Uint8 b; }; // Estructura para saber la seccion y subseccion del programa struct section_t { Uint8 name; Uint8 subsection; }; // Estructura con todas las opciones de configuración del programa struct options_t { Uint8 difficulty; // Dificultad del juego Uint8 language; // Idioma usado en el juego Uint32 fullScreenMode; // Contiene el valor del modo de pantalla completa Uint8 windowSize; // Contiene el valor del tamaño de la ventana Uint32 filter; // Filtro usado para el escalado de la imagen bool vSync; // Indica si se quiere usar vsync o no }; // Calcula el cuadrado de la distancia entre dos puntos double distanceSquared(int x1, int y1, int x2, int y2); // Detector de colisiones entre dos circulos bool checkCollision(circle_t &a, circle_t &b); // Detector de colisiones entre un circulo y un rectangulo bool checkCollision(circle_t &a, SDL_Rect &b); // Detector de colisiones entre un dos rectangulos bool checkCollision(SDL_Rect &a, SDL_Rect &b); // Carga un archivo de imagen en una textura bool loadTextureFromFile(LTexture *texture, std::string path, SDL_Renderer *renderer); // Devuelve un color_t a partir de un string color_t stringToColor(std::string str); #endif