mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Add CUIRect::TopLeft
and Size
convenience functions
This commit is contained in:
parent
e81a561702
commit
4d09332b83
|
@ -136,7 +136,24 @@ public:
|
|||
void Draw(ColorRGBA Color, int Corners, float Rounding) const;
|
||||
void Draw4(ColorRGBA ColorTopLeft, ColorRGBA ColorTopRight, ColorRGBA ColorBottomLeft, ColorRGBA ColorBottomRight, int Corners, float Rounding) const;
|
||||
|
||||
vec2 Center() const { return vec2(x + w / 2.0f, y + h / 2.0f); }
|
||||
/**
|
||||
* Returns the top-left position of *this* CUIRect as a vec2.
|
||||
*
|
||||
* @return Top-left position as vec2.
|
||||
*/
|
||||
vec2 TopLeft() const { return vec2(x, y); }
|
||||
/**
|
||||
* Returns the size of *this* CUIRect as a vec2.
|
||||
*
|
||||
* @return Size as vec2.
|
||||
*/
|
||||
vec2 Size() const { return vec2(w, h); }
|
||||
/**
|
||||
* Returns the center position of *this* CUIRect as a vec2.
|
||||
*
|
||||
* @return Center position as vec2.
|
||||
*/
|
||||
vec2 Center() const { return TopLeft() + Size() / 2.0f; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue