package lib; import lib.Vec.Vec2; /** Reporesents a Point in a 2D `Int` System. Basicly a wrapper for Vec2 with some extra functions. **/ @:forward(x,y) abstract Pos(Vec2) from Vec2 to Vec2{ inline public function new(i:Vec2) { this = i; } @:op(A + B) public function add(rhs: Vec2):Pos { return new Pos({ y: this.y + rhs.y, x: this.x + rhs.x, }); } @:op(A - B) public function sub(rhs: Vec2):Pos { return new Pos({ y: this.y - rhs.y, x: this.x - rhs.x, }); } @:op(A * B) public function multiply(rhs: Vec2): Pos { return new Pos({ y: this.y * rhs.y, x: this.x * rhs.x, }); } @:op(-A) public function negate(): Pos { return new Pos({ y: -this.y, x: -this.x, }); } }