mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-04-11 14:22:37 +02: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;
|
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 {
|
inline Rect2i grow_margin(Margin p_margin, int p_amount) const {
|
||||||
Rect2i g = *this;
|
Rect2i g = *this;
|
||||||
g = g.grow_individual((MARGIN_LEFT == p_margin) ? p_amount : 0,
|
g = g.grow_individual((MARGIN_LEFT == p_margin) ? p_amount : 0,
|
||||||
@ -226,6 +233,8 @@ struct _NO_DISCARD_CLASS_ Rect2i {
|
|||||||
return position + size;
|
return position + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rect2 to_rect2() const { return Rect2(position, size); }
|
||||||
|
|
||||||
operator String() const;
|
operator String() const;
|
||||||
operator Rect2() const { return Rect2(position, size); }
|
operator Rect2() const { return Rect2(position, size); }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user