mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
added HSplitMid function
This commit is contained in:
parent
6ece07ee74
commit
fee3f19b32
|
@ -94,6 +94,28 @@ void CUI::ClipDisable()
|
||||||
Graphics()->ClipDisable();
|
Graphics()->ClipDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CUIRect::HSplitMid(CUIRect *pTop, CUIRect *pBottom) const
|
||||||
|
{
|
||||||
|
CUIRect r = *this;
|
||||||
|
float Cut = r.h/2;
|
||||||
|
|
||||||
|
if(pTop)
|
||||||
|
{
|
||||||
|
pTop->x = r.x;
|
||||||
|
pTop->y = r.y;
|
||||||
|
pTop->w = r.w;
|
||||||
|
pTop->h = Cut;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pBottom)
|
||||||
|
{
|
||||||
|
pBottom->x = r.x;
|
||||||
|
pBottom->y = r.y + Cut;
|
||||||
|
pBottom->w = r.w;
|
||||||
|
pBottom->h = r.h - Cut;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CUIRect::HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const
|
void CUIRect::HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const
|
||||||
{
|
{
|
||||||
CUIRect r = *this;
|
CUIRect r = *this;
|
||||||
|
|
|
@ -10,6 +10,7 @@ class CUIRect
|
||||||
public:
|
public:
|
||||||
float x, y, w, h;
|
float x, y, w, h;
|
||||||
|
|
||||||
|
void HSplitMid(CUIRect *pTop, CUIRect *pBottom) const;
|
||||||
void HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const;
|
void HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const;
|
||||||
void HSplitBottom(float Cut, CUIRect *pTop, CUIRect *pBottom) const;
|
void HSplitBottom(float Cut, CUIRect *pTop, CUIRect *pBottom) const;
|
||||||
void VSplitMid(CUIRect *pLeft, CUIRect *pRight) const;
|
void VSplitMid(CUIRect *pLeft, CUIRect *pRight) const;
|
||||||
|
|
Loading…
Reference in a new issue