feat: Vector2D Default Directions

This commit is contained in:
Syntriax 2024-01-22 12:55:20 +03:00
parent 661f2027ce
commit fd3d1c2e38
1 changed files with 6 additions and 0 deletions

View File

@ -4,6 +4,12 @@ namespace Syntriax.Engine.Physics2D.Primitives;
public record Vector2D(float X, float Y)
{
public readonly static Vector2D Up = new(0f, 1f);
public readonly static Vector2D Down = new(0f, -1f);
public readonly static Vector2D Left = new(-1f, 0f);
public readonly static Vector2D Right = new(1f, 0f);
public readonly static Vector2D One = new(1f, 1f);
public static Vector2D operator +(Vector2D left, Vector2D right) => new(left.X + right.X, left.Y + right.Y);
public static Vector2D operator -(Vector2D left, Vector2D right) => new(left.X - right.X, left.Y - right.Y);
public static Vector2D operator *(Vector2D vector, float value) => new(vector.X * value, vector.Y * value);