MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / renderBorder

Function renderBorder

Engine/source/gui/core/guiDefaultControlRender.cpp:103–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103void renderBorder( const RectI &bounds, GuiControlProfile *profile )
104{
105 S32 l = bounds.point.x, r = bounds.point.x + bounds.extent.x - 1;
106 S32 t = bounds.point.y, b = bounds.point.y + bounds.extent.y - 1;
107
108 GFXDrawUtil *drawer = GFX->getDrawUtil();
109
110 switch(profile->mBorder)
111 {
112 case 1:
113 drawer->drawRect(bounds, profile->mBorderColor);
114 break;
115 case 2:
116 drawer->drawLine(l + 1, t + 1, l + 1, b - 2, profile->mBevelColorHL);
117 drawer->drawLine(l + 2, t + 1, r - 2, t + 1, profile->mBevelColorHL);
118 drawer->drawLine(r, t, r, b, profile->mBevelColorHL);
119 drawer->drawLine(l, b, r - 1, b, profile->mBevelColorHL);
120 drawer->drawLine(l, t, r - 1, t, profile->mBorderColorNA);
121 drawer->drawLine(l, t + 1, l, b - 1, profile->mBorderColorNA);
122 drawer->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mBorderColorNA);
123 drawer->drawLine(r - 1, t + 1, r - 1, b - 2, profile->mBorderColorNA);
124 break;
125 case 3:
126 drawer->drawLine(l, b, r, b, profile->mBevelColorHL);
127 drawer->drawLine(r, t, r, b - 1, profile->mBevelColorHL);
128 drawer->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mFillColor);
129 drawer->drawLine(r - 1, t + 1, r - 1, b - 2, profile->mFillColor);
130 drawer->drawLine(l, t, l, b - 1, profile->mBorderColorNA);
131 drawer->drawLine(l + 1, t, r - 1, t, profile->mBorderColorNA);
132 drawer->drawLine(l + 1, t + 1, l + 1, b - 2, profile->mBevelColorLL);
133 drawer->drawLine(l + 2, t + 1, r - 2, t + 1, profile->mBevelColorLL);
134 break;
135 case 4:
136 drawer->drawLine(l, t, l, b - 1, profile->mBevelColorHL);
137 drawer->drawLine(l + 1, t, r, t, profile->mBevelColorHL);
138 drawer->drawLine(l, b, r, b, profile->mBevelColorLL);
139 drawer->drawLine(r, t + 1, r, b - 1, profile->mBevelColorLL);
140 drawer->drawLine(l + 1, b - 1, r - 1, b - 1, profile->mBorderColor);
141 drawer->drawLine(r - 1, t + 1, r - 1, b - 2, profile->mBorderColor);
142 break;
143 case 5:
144 renderFilledBorder( bounds, profile );
145 break;
146 //
147 case -1:
148 // Draw a simple sizable border with corners
149 // Taken from the 'Skinnable GUI Controls in TGE' resource by Justin DuJardin
150 if(profile->mBitmapArrayRects.size() >= 8)
151 {
152 drawer->clearBitmapModulation();
153
154 RectI destRect;
155 RectI stretchRect;
156 RectI* mBitmapBounds = profile->mBitmapArrayRects.address();
157
158 // Indices into the bitmap array
159 enum
160 {

Callers 10

onRenderMethod · 0.85
onRenderMethod · 0.85
onRenderMethod · 0.85
onRenderMethod · 0.85
onRenderMethod · 0.85
onRenderMethod · 0.85
onRenderMethod · 0.85
onRenderMethod · 0.85
onRenderMethod · 0.85
renderSceneMethod · 0.85

Calls 13

renderFilledBorderFunction · 0.85
getDrawUtilMethod · 0.80
drawRectMethod · 0.80
clearBitmapModulationMethod · 0.80
drawBitmapSRMethod · 0.80
insetMethod · 0.80
drawBitmapStretchSRMethod · 0.80
Point2IClass · 0.50
drawLineMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected