From e1bb9c3ac3e7bdfff2d7b97cfabacdcd3682b925 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Tue, 26 Apr 2022 19:42:50 +0200 Subject: [PATCH] Pos2 multiply and negate --- src/util/Pos.hx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/util/Pos.hx b/src/util/Pos.hx index e59a95f..99645b7 100644 --- a/src/util/Pos.hx +++ b/src/util/Pos.hx @@ -27,4 +27,20 @@ abstract Pos(Vec2) from Vec2 to Vec2{ 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, + }); + } }