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

Method onRender

Engine/source/gui/containers/guiFormCtrl.cpp:244–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244void GuiFormCtrl::onRender(Point2I offset, const RectI &updateRect)
245{
246 // Fill in the control's child area
247 RectI boundsRect(offset, getExtent());
248 boundsRect.point.y += mThumbSize.y;
249 boundsRect.extent.y -= mThumbSize.y;
250
251 // draw the border of the form if specified
252 if (mProfile->mOpaque)
253 GFX->getDrawUtil()->drawRectFill(boundsRect, mProfile->mFillColor);
254
255 if (mProfile->mBorder)
256 renderBorder(boundsRect, mProfile);
257
258 // If we don't have a child, put some text in the child area
259 if( empty() )
260 {
261 GFX->getDrawUtil()->setBitmapModulation(ColorI(0,0,0));
262 renderJustifiedText(boundsRect.point, boundsRect.extent, "[none]");
263 }
264
265 S32 textWidth = 0;
266
267 // Draw our little bar, too
268 if (mProfile->mBitmapArrayRects.size() >= 5)
269 {
270 GFX->getDrawUtil()->clearBitmapModulation();
271
272 S32 barStart = offset.x + textWidth;
273 S32 barTop = mThumbSize.y / 2 + offset.y - mProfile->mBitmapArrayRects[3].extent.y / 2;
274
275 Point2I barOffset(barStart, barTop);
276
277 // Draw the start of the bar...
278 GFX->getDrawUtil()->drawBitmapStretchSR(mProfile->mTextureObject ,RectI(barOffset, mProfile->mBitmapArrayRects[2].extent), mProfile->mBitmapArrayRects[2] );
279
280 // Now draw the middle...
281 barOffset.x += mProfile->mBitmapArrayRects[2].extent.x;
282
283 S32 barMiddleSize = (getExtent().x - (barOffset.x - offset.x)) - mProfile->mBitmapArrayRects[4].extent.x + 1;
284
285 if (barMiddleSize > 0)
286 {
287 // We have to do this inset to prevent nasty stretching artifacts
288 RectI foo = mProfile->mBitmapArrayRects[3];
289 foo.inset(1,0);
290
291 GFX->getDrawUtil()->drawBitmapStretchSR(
292 mProfile->mTextureObject,
293 RectI(barOffset, Point2I(barMiddleSize, mProfile->mBitmapArrayRects[3].extent.y)),
294 foo
295 );
296 }
297
298 // And the end
299 barOffset.x += barMiddleSize;
300
301 GFX->getDrawUtil()->drawBitmapStretchSR( mProfile->mTextureObject, RectI(barOffset, mProfile->mBitmapArrayRects[4].extent),

Callers

nothing calls this directly

Calls 13

renderBorderFunction · 0.85
getWidthFunction · 0.85
drawRectFillMethod · 0.80
getDrawUtilMethod · 0.80
setBitmapModulationMethod · 0.80
clearBitmapModulationMethod · 0.80
drawBitmapStretchSRMethod · 0.80
insetMethod · 0.80
emptyFunction · 0.50
ColorIClass · 0.50
RectIClass · 0.50
Point2IClass · 0.50

Tested by

no test coverage detected