added Recti.contains

This commit is contained in:
DaniTheSkunk 2022-11-08 00:17:52 +00:00
parent 21c4d8ccdc
commit a7d8b9f5c7
1 changed files with 8 additions and 0 deletions

View File

@ -54,4 +54,12 @@ public final class Recti {
public Vec2i getBottomRight() { public Vec2i getBottomRight() {
return Vec2i.add(pos, size); return Vec2i.add(pos, size);
} }
public boolean contains(Vec2i vec) {
var br = getBottomRight();
return vec.getX() >= pos.getX() &&
vec.getY() >= pos.getY() &&
vec.getX() <= br.getX() &&
vec.getY() <= br.getY();
}
} }