mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 03:46:50 +01:00
Added grow_by and to_rect2 helper method to Rect2i.
This commit is contained in:
parent
0f6fb760ad
commit
59933a9e60
@ -158,6 +158,13 @@ struct _NO_DISCARD_CLASS_ Rect2i {
|
||||
return g;
|
||||
}
|
||||
|
||||
void grow_by(int p_by) {
|
||||
position.x -= p_by;
|
||||
position.y -= p_by;
|
||||
size.width += p_by * 2;
|
||||
size.height += p_by * 2;
|
||||
}
|
||||
|
||||
inline Rect2i grow_margin(Margin p_margin, int p_amount) const {
|
||||
Rect2i g = *this;
|
||||
g = g.grow_individual((MARGIN_LEFT == p_margin) ? p_amount : 0,
|
||||
@ -226,6 +233,8 @@ struct _NO_DISCARD_CLASS_ Rect2i {
|
||||
return position + size;
|
||||
}
|
||||
|
||||
Rect2 to_rect2() const { return Rect2(position, size); }
|
||||
|
||||
operator String() const;
|
||||
operator Rect2() const { return Rect2(position, size); }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user