added Pos
This commit is contained in:
parent
3304d10da5
commit
1b9009d8e3
26
src/util/Pos.hx
Normal file
26
src/util/Pos.hx
Normal file
@ -0,0 +1,26 @@
|
||||
package util;
|
||||
|
||||
import util.Vec.Vec2;
|
||||
|
||||
@:forward(x,y)
|
||||
abstract Pos(Vec2<Int>) from Vec2<Int> to Vec2<Int>{
|
||||
inline public function new(i:Vec2<Int>) {
|
||||
this = i;
|
||||
}
|
||||
|
||||
@:op(A + B)
|
||||
public function add(rhs: Vec2<Int>):Pos {
|
||||
return new Pos({
|
||||
y: this.y + rhs.y,
|
||||
x: this.x + rhs.x,
|
||||
});
|
||||
}
|
||||
|
||||
@:op(A - B)
|
||||
public function sub(rhs: Vec2<Int>):Pos {
|
||||
return new Pos({
|
||||
y: this.y - rhs.y,
|
||||
x: this.x - rhs.x,
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user