Skip to content

Commit

Permalink
Fixed contains to accept a vd2d. Other types will be cast into vd2d a…
Browse files Browse the repository at this point in the history
…nyway.
  • Loading branch information
bXi committed Mar 20, 2024
1 parent 9b12f3b commit e5ae1e9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions utils/rectangles.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ union rect_generic {

rect_generic(T _x, T _y, T _width, T _height) : x(_x), y(_y), width(_width), height(_height) {}

bool contains(const v2d_generic<T> &_point) {
return !(_point.x < this->pos.x || _point.y < this->pos.y ||
_point.x > (this->pos.x + this->size.x) || _point.y > (this->pos.y + this->size.y));

bool contains(const vd2d& _point) {
return !(_point.x < this->pos.x ||
_point.y < this->pos.y ||
_point.x > (this->pos.x + this->size.x) ||
_point.y > (this->pos.y + this->size.y));
}

#if __has_include("SDL3/SDL.h")
Expand All @@ -46,5 +49,3 @@ typedef rect_generic<int32_t> recti;
typedef rect_generic<uint32_t> rectu;
typedef rect_generic<float> rectf;
typedef rect_generic<double> rectd;


0 comments on commit e5ae1e9

Please sign in to comment.