Skip to content

Commit

Permalink
Merge branch 'main' of github.com:NoelFB/Foster
Browse files Browse the repository at this point in the history
  • Loading branch information
NoelFB committed Nov 11, 2023
2 parents da0cab3 + 65aa678 commit f7cf065
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Framework/Extensions/VectorExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ public static Vector2 EightWayNormal(this Vector2 vector)
/// <summary>
/// Returns a Vector2 with the X-value of this Vector2, but zero Y
/// </summary>
public static Vector2 OnlyX(this Vector2 vector) => new Vector2(vector.X, 0);
public static Vector2 ZeroY(this Vector2 vector) => new Vector2(vector.X, 0);

/// <summary>
/// Returns a Vector2 with the Y-value of this Vector2, but zero X
/// </summary>
public static Vector2 OnlyY(this Vector2 vector) => new Vector2(0, vector.Y);
public static Vector2 ZeroX(this Vector2 vector) => new Vector2(0, vector.Y);
}
6 changes: 3 additions & 3 deletions Framework/Spatial/Point2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ public static Point2 FromBools(bool left, bool right, bool up, bool down)
public static Vector2 operator *(Point2 point, float scaler) => new(point.X * scaler, point.Y * scaler);
public static Vector2 operator %(Point2 point, float scaler) => new(point.X % scaler, point.Y % scaler);

public static Point2 operator /(Point2 point, Point2 vector) => new(point.X / vector.X, point.Y / vector.Y);
public static Point2 operator *(Point2 point, Point2 vector) => new(point.X * vector.X, point.Y * vector.Y);
public static Point2 operator %(Point2 point, Point2 vector) => new(point.X % vector.X, point.Y % vector.Y);
public static Point2 operator /(Point2 a, Point2 b) => new(a.X / b.X, a.Y / b.Y);
public static Point2 operator *(Point2 a, Point2 b) => new(a.X * b.X, a.Y * b.Y);
public static Point2 operator %(Point2 a, Point2 b) => new(a.X % b.X, a.Y % b.Y);

public static Vector2 operator /(Point2 point, Vector2 vector) => new(point.X / vector.X, point.Y / vector.Y);
public static Vector2 operator *(Point2 point, Vector2 vector) => new(point.X * vector.X, point.Y * vector.Y);
Expand Down
5 changes: 5 additions & 0 deletions Framework/Utility/Calc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,11 @@ public static float Clamp(float value)
/// </summary>
public static int Floor(float v) => (int)MathF.Floor(v);

/// <summary>
/// Shorthand to MathF.Ceiling but returns an Integer
/// </summary>
public static int Ceil(float v) => (int)MathF.Ceiling(v);

/// <summary>
/// Converts a value from 0 to 1, to 0 to 1 to 0
/// </summary>
Expand Down

0 comments on commit f7cf065

Please sign in to comment.