clang-format

clang-tidy (macos)
This commit is contained in:
2026-03-23 07:26:21 +01:00
parent 0ddb6c85e1
commit 6595b28790
65 changed files with 583 additions and 570 deletions

View File

@@ -226,8 +226,8 @@ auto checkCollision(const Line& l1, const Line& l2) -> SDL_Point {
const float Y4 = l2.y2;
// calculate the direction of the lines
float u_a = ((X4 - X3) * (Y1 - Y3) - (Y4 - Y3) * (X1 - X3)) / ((Y4 - Y3) * (X2 - X1) - (X4 - X3) * (Y2 - Y1));
float u_b = ((X2 - X1) * (Y1 - Y3) - (Y2 - Y1) * (X1 - X3)) / ((Y4 - Y3) * (X2 - X1) - (X4 - X3) * (Y2 - Y1));
float u_a = (((X4 - X3) * (Y1 - Y3)) - ((Y4 - Y3) * (X1 - X3))) / (((Y4 - Y3) * (X2 - X1)) - ((X4 - X3) * (Y2 - Y1)));
float u_b = (((X2 - X1) * (Y1 - Y3)) - ((Y2 - Y1) * (X1 - X3))) / (((Y4 - Y3) * (X2 - X1)) - ((X4 - X3) * (Y2 - Y1)));
// if uA and uB are between 0-1, lines are colliding
if (u_a >= 0 && u_a <= 1 && u_b >= 0 && u_b <= 1) {
@@ -235,9 +235,9 @@ auto checkCollision(const Line& l1, const Line& l2) -> SDL_Point {
const float X = X1 + (u_a * (X2 - X1));
const float Y = Y1 + (u_a * (Y2 - Y1));
return {static_cast<int>(std::round(X)), static_cast<int>(std::round(Y))};
return {.x = static_cast<int>(std::round(X)), .y = static_cast<int>(std::round(Y))};
}
return {-1, -1};
return {.x = -1, .y = -1};
}
// Detector de colisiones entre dos lineas
@@ -253,8 +253,8 @@ auto checkCollision(const LineDiagonal& l1, const LineVertical& l2) -> SDL_Point
const float Y4 = l2.y2;
// calculate the direction of the lines
float u_a = ((X4 - X3) * (Y1 - Y3) - (Y4 - Y3) * (X1 - X3)) / ((Y4 - Y3) * (X2 - X1) - (X4 - X3) * (Y2 - Y1));
float u_b = ((X2 - X1) * (Y1 - Y3) - (Y2 - Y1) * (X1 - X3)) / ((Y4 - Y3) * (X2 - X1) - (X4 - X3) * (Y2 - Y1));
float u_a = (((X4 - X3) * (Y1 - Y3)) - ((Y4 - Y3) * (X1 - X3))) / (((Y4 - Y3) * (X2 - X1)) - ((X4 - X3) * (Y2 - Y1)));
float u_b = (((X2 - X1) * (Y1 - Y3)) - ((Y2 - Y1) * (X1 - X3))) / (((Y4 - Y3) * (X2 - X1)) - ((X4 - X3) * (Y2 - Y1)));
// if uA and uB are between 0-1, lines are colliding
if (u_a >= 0 && u_a <= 1 && u_b >= 0 && u_b <= 1) {
@@ -262,9 +262,9 @@ auto checkCollision(const LineDiagonal& l1, const LineVertical& l2) -> SDL_Point
const float X = X1 + (u_a * (X2 - X1));
const float Y = Y1 + (u_a * (Y2 - Y1));
return {static_cast<int>(X), static_cast<int>(Y)};
return {.x = static_cast<int>(X), .y = static_cast<int>(Y)};
}
return {-1, -1};
return {.x = -1, .y = -1};
}
// Normaliza una linea diagonal