by rmeby · 3y ago · 0 comments
public static Vector operator -(Vector a, Vector b)
{
Vector v = new Vector();
v.X = a.X - b.X;
v.Y = a.Y - b.Y;
return v;
}
So then you can just write: Vector result = myVector1 - myVector2;At one point Mozilla had a prototype implementation of strongly-typed value types in JavaScript, but it fell by the wayside once WebAssembly became a thing.
var result = myvector1.sub(myvector2)