Arreglos en la estructura i format del codi

This commit is contained in:
2025-03-02 09:32:25 +01:00
parent 193dac708f
commit b1ba5e67dc
41 changed files with 611 additions and 739 deletions

View File

@@ -1,11 +1,10 @@
#pragma once
#include <SDL2/SDL_rect.h> // for SDL_Rect, SDL_Point
#include <SDL2/SDL_stdinc.h> // for Uint8
#include <string> // for string
#include <vector>
#include <SDL2/SDL_render.h> // for SDL_Renderer
#include <SDL2/SDL.h> // for SDL_Texture
#include <SDL2/SDL_rect.h> // for SDL_Rect, SDL_Point
#include <SDL2/SDL_render.h> // for SDL_Renderer, SDL_Texture
#include <SDL2/SDL_stdinc.h> // for Uint8
#include <string> // for string
#include <vector> // for vector
// Tipos de paleta
enum class Palette : int
@@ -23,25 +22,25 @@ struct Circle
};
// Estructura para definir una linea horizontal
struct h_line_t
struct LineHorizontal
{
int x1, x2, y;
};
// Estructura para definir una linea vertical
struct v_line_t
struct LineVertical
{
int x, y1, y2;
};
// Estructura para definir una linea diagonal
struct d_line_t
struct LineDiagonal
{
int x1, y1, x2, y2;
};
// Estructura para definir una linea
struct line_t
struct Line
{
int x1, y1, x2, y2;
};
@@ -77,25 +76,25 @@ bool checkCollision(const SDL_Rect &a, const SDL_Rect &b);
bool checkCollision(const SDL_Point &p, const SDL_Rect &r);
// Detector de colisiones entre una linea horizontal y un rectangulo
bool checkCollision(const h_line_t &l, const SDL_Rect &r);
bool checkCollision(const LineHorizontal &l, const SDL_Rect &r);
// Detector de colisiones entre una linea vertical y un rectangulo
bool checkCollision(const v_line_t &l, const SDL_Rect &r);
bool checkCollision(const LineVertical &l, const SDL_Rect &r);
// Detector de colisiones entre una linea horizontal y un punto
bool checkCollision(const h_line_t &l, const SDL_Point &p);
bool checkCollision(const LineHorizontal &l, const SDL_Point &p);
// Detector de colisiones entre dos lineas
SDL_Point checkCollision(const line_t &l1, const line_t &l2);
SDL_Point checkCollision(const Line &l1, const Line &l2);
// Detector de colisiones entre dos lineas
SDL_Point checkCollision(const d_line_t &l1, const v_line_t &l2);
SDL_Point checkCollision(const LineDiagonal &l1, const LineVertical &l2);
// Detector de colisiones entre un punto y una linea diagonal
bool checkCollision(const SDL_Point &p, const d_line_t &l);
bool checkCollision(const SDL_Point &p, const LineDiagonal &l);
// Normaliza una linea diagonal
void normalizeLine(d_line_t &l);
void normalizeLine(LineDiagonal &l);
// Devuelve un Color a partir de un string
Color stringToColor(Palette pal, const std::string &str);