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

Method onRender

Engine/source/gui/containers/guiWindowCtrl.cpp:1302–1458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1300//-----------------------------------------------------------------------------
1301
1302void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
1303{
1304 if( !mProfile || mProfile->mFont == NULL || mProfile->mBitmapArrayRects.size() < NumBitmaps )
1305 return Parent::onRender( offset, updateRect );
1306
1307 // Draw the outline
1308 RectI winRect;
1309 winRect.point = offset;
1310 winRect.extent = getExtent();
1311 GuiCanvas *root = getRoot();
1312 GuiControl *firstResponder = root ? root->getFirstResponder() : NULL;
1313
1314 bool isKey = (!firstResponder || controlIsChild(firstResponder));
1315
1316 U32 topBase = isKey ? BorderTopLeftKey : BorderTopLeftNoKey;
1317 winRect.point.x += mBitmapBounds[BorderLeft].extent.x;
1318 winRect.point.y += mBitmapBounds[topBase + 2].extent.y;
1319
1320 winRect.extent.x -= mBitmapBounds[BorderLeft].extent.x + mBitmapBounds[BorderRight].extent.x;
1321 winRect.extent.y -= mBitmapBounds[topBase + 2].extent.y + mBitmapBounds[BorderBottom].extent.y;
1322
1323 winRect.extent.x += 1;
1324
1325 GFXDrawUtil* drawUtil = GFX->getDrawUtil();
1326
1327 drawUtil->drawRectFill(winRect, mProfile->mFillColor);
1328
1329 drawUtil->clearBitmapModulation();
1330 drawUtil->drawBitmapSR(mTextureObject, offset, mBitmapBounds[topBase]);
1331 drawUtil->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[topBase+1].extent.x, offset.y),
1332 mBitmapBounds[topBase + 1]);
1333
1334 RectI destRect;
1335 destRect.point.x = offset.x + mBitmapBounds[topBase].extent.x;
1336 destRect.point.y = offset.y;
1337 destRect.extent.x = getWidth() - mBitmapBounds[topBase].extent.x - mBitmapBounds[topBase + 1].extent.x;
1338 destRect.extent.y = mBitmapBounds[topBase + 2].extent.y;
1339 RectI stretchRect = mBitmapBounds[topBase + 2];
1340 stretchRect.inset(1,0);
1341 drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
1342
1343 destRect.point.x = offset.x;
1344 destRect.point.y = offset.y + mBitmapBounds[topBase].extent.y;
1345 destRect.extent.x = mBitmapBounds[BorderLeft].extent.x;
1346 destRect.extent.y = getHeight() - mBitmapBounds[topBase].extent.y - mBitmapBounds[BorderBottomLeft].extent.y;
1347 stretchRect = mBitmapBounds[BorderLeft];
1348 stretchRect.inset(0,1);
1349 drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
1350
1351 destRect.point.x = offset.x + getWidth() - mBitmapBounds[BorderRight].extent.x;
1352 destRect.extent.x = mBitmapBounds[BorderRight].extent.x;
1353 destRect.point.y = offset.y + mBitmapBounds[topBase + 1].extent.y;
1354 destRect.extent.y = getHeight() - mBitmapBounds[topBase + 1].extent.y - mBitmapBounds[BorderBottomRight].extent.y;
1355
1356 stretchRect = mBitmapBounds[BorderRight];
1357 stretchRect.inset(0,1);
1358 drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
1359

Callers

nothing calls this directly

Calls 15

getWidthFunction · 0.85
getDrawUtilMethod · 0.80
drawRectFillMethod · 0.80
clearBitmapModulationMethod · 0.80
drawBitmapSRMethod · 0.80
insetMethod · 0.80
drawBitmapStretchSRMethod · 0.80
setBitmapModulationMethod · 0.80
getStrWidthMethod · 0.80
pointInRectMethod · 0.80
Point2IClass · 0.50
getHeightFunction · 0.50

Tested by

no test coverage detected