added Rect::inflate(x, y)

This commit is contained in:
Noel Berry 2022-03-15 20:16:02 -07:00
parent cbb194e516
commit 05391f0b3d

View File

@ -204,6 +204,7 @@ namespace Blah
constexpr Rect scale(T s) const; constexpr Rect scale(T s) const;
constexpr Rect scale(T sx, T sy) const; constexpr Rect scale(T sx, T sy) const;
constexpr Rect inflate(T amount) const; constexpr Rect inflate(T amount) const;
constexpr Rect inflate(T amount_x, T amount_y) const;
// Rect Sectors: // Rect Sectors:
// 0101 0100 0110 // 0101 0100 0110
@ -794,6 +795,11 @@ namespace Blah
return Rect(x - amount, y - amount, w + amount * 2, h + amount * 2); return Rect(x - amount, y - amount, w + amount * 2, h + amount * 2);
} }
template<class T>
constexpr Rect<T> Rect<T>::inflate(T amount_x, T amount_y) const {
return Rect(x - amount_x, y - amount_y, w + amount_x * 2, h + amount_y * 2);
}
template<class T> template<class T>
constexpr u8 Rect<T>::get_sector(const Vec2<T>& pt) const constexpr u8 Rect<T>::get_sector(const Vec2<T>& pt) const
{ {