about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/game/client/ui.cpp22
-rw-r--r--src/game/client/ui.h1
2 files changed, 23 insertions, 0 deletions
diff --git a/src/game/client/ui.cpp b/src/game/client/ui.cpp
index 020a0c70..23643e2a 100644
--- a/src/game/client/ui.cpp
+++ b/src/game/client/ui.cpp
@@ -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;
diff --git a/src/game/client/ui.h b/src/game/client/ui.h
index 9ff85dd5..c339de73 100644
--- a/src/game/client/ui.h
+++ b/src/game/client/ui.h
@@ -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;