added HSplitMid function

This commit is contained in:
oy 2011-03-26 16:19:37 +01:00
parent 6ece07ee74
commit fee3f19b32
2 changed files with 23 additions and 0 deletions

View file

@ -94,6 +94,28 @@ void CUI::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
{
CUIRect r = *this;

View file

@ -10,6 +10,7 @@ class CUIRect
public:
float x, y, w, h;
void HSplitMid(CUIRect *pTop, CUIRect *pBottom) const;
void HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const;
void HSplitBottom(float Cut, CUIRect *pTop, CUIRect *pBottom) const;
void VSplitMid(CUIRect *pLeft, CUIRect *pRight) const;