DDraceNetwork Docs
ui_rect.h
Go to the documentation of this file.
1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef GAME_CLIENT_UI_RECT_H
4#define GAME_CLIENT_UI_RECT_H
5
6#include <base/color.h>
7
8class IGraphics;
9
11{
13
14public:
15 static void Init(IGraphics *pGraphics) { s_pGraphics = pGraphics; }
16
17 float x, y, w, h;
18
26 void HSplitMid(CUIRect *pTop, CUIRect *pBottom, float Spacing = 0.0f) const;
38 void HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const;
50 void HSplitBottom(float Cut, CUIRect *pTop, CUIRect *pBottom) const;
58 void VSplitMid(CUIRect *pLeft, CUIRect *pRight, float Spacing = 0.0f) const;
70 void VSplitLeft(float Cut, CUIRect *pLeft, CUIRect *pRight) const;
82 void VSplitRight(float Cut, CUIRect *pLeft, CUIRect *pRight) const;
83
92 void Margin(vec2 Cut, CUIRect *pOtherRect) const;
99 void Margin(float Cut, CUIRect *pOtherRect) const;
106 void VMargin(float Cut, CUIRect *pOtherRect) const;
113 void HMargin(float Cut, CUIRect *pOtherRect) const;
114
121 bool Inside(vec2 Point) const;
122
136 void Draw(ColorRGBA Color, int Corners, float Rounding) const;
137 void Draw4(ColorRGBA ColorTopLeft, ColorRGBA ColorTopRight, ColorRGBA ColorBottomLeft, ColorRGBA ColorBottomRight, int Corners, float Rounding) const;
138
144 vec2 TopLeft() const { return vec2(x, y); }
150 vec2 Size() const { return vec2(w, h); }
156 vec2 Center() const { return TopLeft() + Size() / 2.0f; }
157};
158
159#endif
Definition: ui_rect.h:11
static IGraphics * s_pGraphics
Definition: ui_rect.h:12
float h
Definition: ui_rect.h:17
vec2 Size() const
Definition: ui_rect.h:150
float y
Definition: ui_rect.h:17
void Margin(vec2 Cut, CUIRect *pOtherRect) const
Definition: ui_rect.cpp:139
void HSplitMid(CUIRect *pTop, CUIRect *pBottom, float Spacing=0.0f) const
Definition: ui_rect.cpp:9
void Draw(ColorRGBA Color, int Corners, float Rounding) const
Definition: ui_rect.cpp:169
void HSplitTop(float Cut, CUIRect *pTop, CUIRect *pBottom) const
Definition: ui_rect.cpp:32
vec2 TopLeft() const
Definition: ui_rect.h:144
void VSplitLeft(float Cut, CUIRect *pLeft, CUIRect *pRight) const
Definition: ui_rect.cpp:97
void HMargin(float Cut, CUIRect *pOtherRect) const
Definition: ui_rect.cpp:159
void VSplitMid(CUIRect *pLeft, CUIRect *pRight, float Spacing=0.0f) const
Definition: ui_rect.cpp:74
void HSplitBottom(float Cut, CUIRect *pTop, CUIRect *pBottom) const
Definition: ui_rect.cpp:53
vec2 Center() const
Definition: ui_rect.h:156
float w
Definition: ui_rect.h:17
void VMargin(float Cut, CUIRect *pOtherRect) const
Definition: ui_rect.cpp:154
bool Inside(vec2 Point) const
Definition: ui_rect.cpp:164
void VSplitRight(float Cut, CUIRect *pLeft, CUIRect *pRight) const
Definition: ui_rect.cpp:118
float x
Definition: ui_rect.h:17
void Draw4(ColorRGBA ColorTopLeft, ColorRGBA ColorTopRight, ColorRGBA ColorBottomLeft, ColorRGBA ColorBottomRight, int Corners, float Rounding) const
Definition: ui_rect.cpp:174
static void Init(IGraphics *pGraphics)
Definition: ui_rect.h:15
Definition: color.h:210
Definition: graphics.h:183
vector2_base< float > vec2
Definition: vmath.h:158