25 return SDL_RectEquals(&a, &b) != SDL_FALSE;
35 s <<
'[' << r.x <<
',' << r.y <<
'|' << r.w <<
',' << r.h <<
']';
41 return SDL_RectEquals(
this, &r) != SDL_FALSE;
46 return SDL_RectEquals(
this, &r) != SDL_FALSE;
51 return SDL_RectEmpty(
this);
57 return SDL_PointInRect(&
p,
this) != SDL_FALSE;
62 return SDL_PointInRect(&point,
this) != SDL_FALSE;
67 if(this->x > r.x)
return false;
68 if(this->y > r.y)
return false;
69 if(this->x + this->
w < r.x + r.w)
return false;
70 if(this->y + this->
h < r.y + r.h)
return false;
76 return SDL_HasIntersection(
this, &r);
82 SDL_UnionRect(
this, &other, &result);
88 SDL_UnionRect(
this, &other,
this);
95 if(!SDL_IntersectRect(
this, &other, &result)) {
114 s <<
'[' << r.x <<
',' << r.y <<
'|' << r.w <<
',' << r.h <<
']';
constexpr rect()
Explicitly initialize rects to 0.
void shift(const point &p)
Shift the rectangle by the given relative position.
bool operator!=(const SDL_Rect &a, const SDL_Rect &b)
bool contains(int x, int y) const
Whether the given point lies within the rectangle.
rect & expand_to_cover(const SDL_Rect &r)
Minimally expand this rect to fully contain another.
rect minimal_cover(const SDL_Rect &r) const
Calculates the minimal rectangle that completely contains both this rectangle and the given rectangle...
void clip(const SDL_Rect &r)
Clip this rectangle by the given rectangle.
rect intersect(const SDL_Rect &r) const
Calculates the intersection of this rectangle and another; that is, the maximal rectangle that is con...
bool overlaps(const SDL_Rect &r) const
Whether the given rectangle and this rectangle overlap.
bool empty() const
False if both w and h are > 0, true otherwise.
bool operator==(const SDL_Rect &a, const SDL_Rect &b)
bool operator==(const rect &r) const
static map_location::DIRECTION s
An abstract description of a rectangle with integer coordinates.
Contains the SDL_Rect helper code.
Contains a wrapper class for the SDL_Window class.
std::ostream & operator<<(std::ostream &s, const SDL_Rect &r)