Pos2 multiply and negate

This commit is contained in:
Djeeberjr 2022-04-26 19:42:50 +02:00
parent aca39ea46f
commit e1bb9c3ac3

View File

@ -27,4 +27,20 @@ abstract Pos(Vec2<Int>) from Vec2<Int> to Vec2<Int>{
x: this.x - rhs.x,
});
}
@:op(A * B)
public function multiply(rhs: Vec2<Int>): 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,
});
}
}