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

Method onRender

Engine/source/gui/containers/guiWindowCtrl.cpp:1274–1430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1272//-----------------------------------------------------------------------------
1273
1274void GuiWindowCtrl::onRender(Point2I offset, const RectI &updateRect)
1275{
1276 if( !mProfile || mProfile->mFont == NULL || mProfile->mBitmapArrayRects.size() < NumBitmaps )
1277 return Parent::onRender( offset, updateRect );
1278
1279 // Draw the outline
1280 RectI winRect;
1281 winRect.point = offset;
1282 winRect.extent = getExtent();
1283 GuiCanvas *root = getRoot();
1284 GuiControl *firstResponder = root ? root->getFirstResponder() : NULL;
1285
1286 bool isKey = (!firstResponder || controlIsChild(firstResponder));
1287
1288 U32 topBase = isKey ? BorderTopLeftKey : BorderTopLeftNoKey;
1289 winRect.point.x += mBitmapBounds[BorderLeft].extent.x;
1290 winRect.point.y += mBitmapBounds[topBase + 2].extent.y;
1291
1292 winRect.extent.x -= mBitmapBounds[BorderLeft].extent.x + mBitmapBounds[BorderRight].extent.x;
1293 winRect.extent.y -= mBitmapBounds[topBase + 2].extent.y + mBitmapBounds[BorderBottom].extent.y;
1294
1295 winRect.extent.x += 1;
1296
1297 GFXDrawUtil* drawUtil = GFX->getDrawUtil();
1298
1299 drawUtil->drawRectFill(winRect, mProfile->mFillColor);
1300
1301 drawUtil->clearBitmapModulation();
1302 drawUtil->drawBitmapSR(mTextureObject, offset, mBitmapBounds[topBase]);
1303 drawUtil->drawBitmapSR(mTextureObject, Point2I(offset.x + getWidth() - mBitmapBounds[topBase+1].extent.x, offset.y),
1304 mBitmapBounds[topBase + 1]);
1305
1306 RectI destRect;
1307 destRect.point.x = offset.x + mBitmapBounds[topBase].extent.x;
1308 destRect.point.y = offset.y;
1309 destRect.extent.x = getWidth() - mBitmapBounds[topBase].extent.x - mBitmapBounds[topBase + 1].extent.x;
1310 destRect.extent.y = mBitmapBounds[topBase + 2].extent.y;
1311 RectI stretchRect = mBitmapBounds[topBase + 2];
1312 stretchRect.inset(1,0);
1313 drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
1314
1315 destRect.point.x = offset.x;
1316 destRect.point.y = offset.y + mBitmapBounds[topBase].extent.y;
1317 destRect.extent.x = mBitmapBounds[BorderLeft].extent.x;
1318 destRect.extent.y = getHeight() - mBitmapBounds[topBase].extent.y - mBitmapBounds[BorderBottomLeft].extent.y;
1319 stretchRect = mBitmapBounds[BorderLeft];
1320 stretchRect.inset(0,1);
1321 drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
1322
1323 destRect.point.x = offset.x + getWidth() - mBitmapBounds[BorderRight].extent.x;
1324 destRect.extent.x = mBitmapBounds[BorderRight].extent.x;
1325 destRect.point.y = offset.y + mBitmapBounds[topBase + 1].extent.y;
1326 destRect.extent.y = getHeight() - mBitmapBounds[topBase + 1].extent.y - mBitmapBounds[BorderBottomRight].extent.y;
1327
1328 stretchRect = mBitmapBounds[BorderRight];
1329 stretchRect.inset(0,1);
1330 drawUtil->drawBitmapStretchSR(mTextureObject, destRect, stretchRect);
1331

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
Point2IClass · 0.50
getHeightFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected