mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 12:09:36 +00:00
More stuff, fix saved games
This commit is contained in:
@@ -27,11 +27,17 @@ struct Rect
|
||||
int16_t right;
|
||||
|
||||
bool IsValid() const;
|
||||
Rect Intersect(const Rect &rect) const;
|
||||
Rect MakeValid() const;
|
||||
|
||||
Rect Intersect(const Rect &rect) const;
|
||||
Rect Inset(int16_t h, int16_t v) const;
|
||||
|
||||
Rect operator-(const Point &point) const;
|
||||
Rect operator+(const Point &point) const;
|
||||
|
||||
Rect &operator-=(const Point &point);
|
||||
Rect &operator+=(const Point &point);
|
||||
|
||||
uint16_t Height() const;
|
||||
uint16_t Width() const;
|
||||
|
||||
@@ -164,6 +170,11 @@ inline Rect Rect::Intersect(const Rect &other) const
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Rect Rect::Inset(int16_t h, int16_t v) const
|
||||
{
|
||||
return Rect::Create(top + v, left + h, bottom - v, right - h);
|
||||
}
|
||||
|
||||
inline Rect Rect::MakeValid() const
|
||||
{
|
||||
Rect result = *this;
|
||||
@@ -186,6 +197,28 @@ inline Rect Rect::operator+(const Point &point) const
|
||||
return Rect::Create(this->top + point.v, this->left + point.h, this->bottom + point.v, this->right + point.h);
|
||||
}
|
||||
|
||||
inline Rect &Rect::operator-=(const Point &point)
|
||||
{
|
||||
this->top -= point.v;
|
||||
this->bottom -= point.v;
|
||||
this->left -= point.h;
|
||||
this->right -= point.h;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline Rect &Rect::operator+=(const Point &point)
|
||||
{
|
||||
this->top += point.v;
|
||||
this->bottom += point.v;
|
||||
this->left += point.h;
|
||||
this->right += point.h;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline uint16_t Rect::Height() const
|
||||
{
|
||||
return static_cast<uint16_t>(static_cast<int32_t>(this->bottom) - static_cast<int32_t>(this->top));
|
||||
|
||||
Reference in New Issue
Block a user