renomena tipus _t/_e a CamelCase (Circle, Color, Section, ...)
This commit is contained in:
+12
-12
@@ -13,7 +13,7 @@ auto distanceSquared(int x1, int y1, int x2, int y2) -> double {
|
||||
}
|
||||
|
||||
// Detector de colisiones entre dos circulos
|
||||
auto checkCollision(const circle_t &a, const circle_t &b) -> bool {
|
||||
auto checkCollision(const Circle &a, const Circle &b) -> bool {
|
||||
// Calcula el radio total al cuadrado
|
||||
int totalRadiusSquared = a.r + b.r;
|
||||
totalRadiusSquared = totalRadiusSquared * totalRadiusSquared;
|
||||
@@ -23,7 +23,7 @@ auto checkCollision(const circle_t &a, const circle_t &b) -> bool {
|
||||
}
|
||||
|
||||
// Detector de colisiones entre un circulo y un rectangulo
|
||||
auto checkCollision(const circle_t &a, const SDL_Rect &b) -> bool {
|
||||
auto checkCollision(const Circle &a, const SDL_Rect &b) -> bool {
|
||||
// Closest point on collision box
|
||||
int cX;
|
||||
int cY;
|
||||
@@ -46,9 +46,9 @@ auto checkCollision(const circle_t &a, const SDL_Rect &b) -> bool {
|
||||
cY = a.y;
|
||||
}
|
||||
|
||||
// If the closest point is inside the circle_t
|
||||
// If the closest point is inside the Circle
|
||||
if (distanceSquared(a.x, a.y, cX, cY) < a.r * a.r) {
|
||||
// This box and the circle_t have collided
|
||||
// This box and the Circle have collided
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ auto checkCollision(const SDL_Point &p, const SDL_Rect &r) -> bool {
|
||||
}
|
||||
|
||||
// Detector de colisiones entre una linea horizontal y un rectangulo
|
||||
auto checkCollision(const h_line_t &l, const SDL_Rect &r) -> bool {
|
||||
auto checkCollision(const HorizontalLine &l, const SDL_Rect &r) -> bool {
|
||||
// Comprueba si la linea esta por encima del rectangulo
|
||||
if (l.y < r.y) {
|
||||
return false;
|
||||
@@ -144,7 +144,7 @@ auto checkCollision(const h_line_t &l, const SDL_Rect &r) -> bool {
|
||||
}
|
||||
|
||||
// Detector de colisiones entre una linea vertical y un rectangulo
|
||||
auto checkCollision(const v_line_t &l, const SDL_Rect &r) -> bool {
|
||||
auto checkCollision(const VerticalLine &l, const SDL_Rect &r) -> bool {
|
||||
// Comprueba si la linea esta por la izquierda del rectangulo
|
||||
if (l.x < r.x) {
|
||||
return false;
|
||||
@@ -170,7 +170,7 @@ auto checkCollision(const v_line_t &l, const SDL_Rect &r) -> bool {
|
||||
}
|
||||
|
||||
// Detector de colisiones entre una linea horizontal y un punto
|
||||
auto checkCollision(const h_line_t &l, const SDL_Point &p) -> bool {
|
||||
auto checkCollision(const HorizontalLine &l, const SDL_Point &p) -> bool {
|
||||
// Comprueba si el punto esta sobre la linea
|
||||
if (p.y > l.y) {
|
||||
return false;
|
||||
@@ -196,7 +196,7 @@ auto checkCollision(const h_line_t &l, const SDL_Point &p) -> bool {
|
||||
}
|
||||
|
||||
// Detector de colisiones entre dos lineas
|
||||
auto checkCollision(const line_t &l1, const line_t &l2) -> SDL_Point {
|
||||
auto checkCollision(const Line &l1, const Line &l2) -> SDL_Point {
|
||||
const float x1 = l1.x1;
|
||||
const float y1 = l1.y1;
|
||||
const float x2 = l1.x2;
|
||||
@@ -223,7 +223,7 @@ auto checkCollision(const line_t &l1, const line_t &l2) -> SDL_Point {
|
||||
}
|
||||
|
||||
// Detector de colisiones entre dos lineas
|
||||
auto checkCollision(const d_line_t &l1, const v_line_t &l2) -> SDL_Point {
|
||||
auto checkCollision(const DiagonalLine &l1, const VerticalLine &l2) -> SDL_Point {
|
||||
const float x1 = l1.x1;
|
||||
const float y1 = l1.y1;
|
||||
const float x2 = l1.x2;
|
||||
@@ -250,7 +250,7 @@ auto checkCollision(const d_line_t &l1, const v_line_t &l2) -> SDL_Point {
|
||||
}
|
||||
|
||||
// Detector de colisiones entre una linea diagonal y una vertical
|
||||
/*bool checkCollision(d_line_t &l1, v_line_t &l2)
|
||||
/*bool checkCollision(DiagonalLine &l1, VerticalLine &l2)
|
||||
{
|
||||
// Normaliza la linea diagonal
|
||||
normalizeLine(l1);
|
||||
@@ -272,7 +272,7 @@ auto checkCollision(const d_line_t &l1, const v_line_t &l2) -> SDL_Point {
|
||||
}*/
|
||||
|
||||
// Normaliza una linea diagonal
|
||||
void normalizeLine(d_line_t &l) {
|
||||
void normalizeLine(DiagonalLine &l) {
|
||||
// Las lineas diagonales van de izquierda a derecha
|
||||
// x2 mayor que x1
|
||||
if (l.x2 < l.x1) {
|
||||
@@ -286,7 +286,7 @@ void normalizeLine(d_line_t &l) {
|
||||
}
|
||||
|
||||
// Detector de colisiones entre un punto y una linea diagonal
|
||||
auto checkCollision(const SDL_Point &p, const d_line_t &l) -> bool {
|
||||
auto checkCollision(const SDL_Point &p, const DiagonalLine &l) -> bool {
|
||||
// Comprueba si el punto está en alineado con la linea
|
||||
if (abs(p.x - l.x1) != abs(p.y - l.y1)) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user