forked from jaildesigner-jailgames/jaildoctors_dilemma
clang-format
clang-tidy (macos)
This commit is contained in:
@@ -40,7 +40,7 @@ namespace Easing {
|
||||
if (t < 0.5F) {
|
||||
return 2.0F * t * t;
|
||||
}
|
||||
return -1.0F + ((4.0F - 2.0F * t) * t);
|
||||
return -1.0F + ((4.0F - (2.0F * t)) * t);
|
||||
}
|
||||
|
||||
// CUBIC (Cúbica: t^3)
|
||||
@@ -156,12 +156,12 @@ namespace Easing {
|
||||
|
||||
// BACK (Overshoot - retrocede antes de avanzar)
|
||||
inline auto backIn(float t, float overshoot = 1.70158F) -> float {
|
||||
return t * t * ((overshoot + 1.0F) * t - overshoot);
|
||||
return t * t * (((overshoot + 1.0F) * t) - overshoot);
|
||||
}
|
||||
|
||||
inline auto backOut(float t, float overshoot = 1.70158F) -> float {
|
||||
const float F = t - 1.0F;
|
||||
return (F * F * ((overshoot + 1.0F) * F + overshoot)) + 1.0F;
|
||||
return (F * F * (((overshoot + 1.0F) * F) + overshoot)) + 1.0F;
|
||||
}
|
||||
|
||||
inline auto backInOut(float t, float overshoot = 1.70158F) -> float {
|
||||
@@ -169,11 +169,11 @@ namespace Easing {
|
||||
|
||||
if (t < 0.5F) {
|
||||
const float F = 2.0F * t;
|
||||
return 0.5F * (F * F * ((S + 1.0F) * F - S));
|
||||
return 0.5F * (F * F * (((S + 1.0F) * F) - S));
|
||||
}
|
||||
|
||||
const float F = (2.0F * t) - 2.0F;
|
||||
return 0.5F * (F * F * ((S + 1.0F) * F + S) + 2.0F);
|
||||
return 0.5F * ((F * F * (((S + 1.0F) * F) + S)) + 2.0F);
|
||||
}
|
||||
|
||||
// ELASTIC (Oscilación elástica - efecto de resorte)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user