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

Method onRender

Engine/source/gui/editor/guiMenuBar.cpp:1295–1369  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1293}
1294
1295void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
1296{
1297 Point2I extent = getExtent();
1298
1299 RectI ctrlRect(offset, extent);
1300
1301 GFXDrawUtil* drawUtil = GFX->getDrawUtil();
1302
1303 //if opaque, fill the update rect with the fill color
1304 if (mProfile->mOpaque)
1305 drawUtil->drawRectFill(RectI(offset, extent), mProfile->mFillColor);
1306
1307 //if there's a border, draw the border
1308 if (mProfile->mBorder)
1309 renderBorder(ctrlRect, mProfile);
1310
1311 for (U32 i = 0; i < mMenuList.size(); ++i)
1312 {
1313 if (!mMenuList[i].visible)
1314 continue;
1315
1316 ColorI fontColor = mProfile->mFontColor;
1317 RectI bounds = mMenuList[i].bounds;
1318 bounds.point += offset;
1319
1320 Point2I start;
1321
1322 start.x = mMenuList[i].bounds.point.x + mHorizontalMargin;
1323 start.y = mMenuList[i].bounds.point.y + (mMenuList[i].bounds.extent.y - mProfile->mFont->getHeight()) / 2;
1324
1325 // Draw the border
1326 if (mMenuList[i].drawBorder)
1327 {
1328 RectI highlightBounds = bounds;
1329 highlightBounds.inset(1, 1);
1330 if (&mMenuList[i] == mouseDownMenu)
1331 renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL);
1332 else if (&mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL)
1333 renderFilledBorder(highlightBounds, mProfile->mBorderColorHL, mProfile->mFillColorHL);
1334 }
1335
1336 // Do we draw a bitmap?
1337 if (mMenuList[i].bitmapIndex != -1)
1338 {
1339 S32 index = mMenuList[i].bitmapIndex * 3;
1340 if (&mMenuList[i] == mouseDownMenu)
1341 ++index;
1342 else if (&mMenuList[i] == mouseOverMenu && mouseDownMenu == NULL)
1343 index += 2;
1344
1345 RectI rect = mProfile->mBitmapArrayRects[index];
1346
1347 Point2I bitmapstart(start);
1348 bitmapstart.y = mMenuList[i].bounds.point.y + (mMenuList[i].bounds.extent.y - rect.extent.y) / 2;
1349
1350 drawUtil->clearBitmapModulation();
1351 drawUtil->drawBitmapSR(mProfile->getBitmapResource(), offset + bitmapstart, rect);
1352

Callers

nothing calls this directly

Calls 13

renderBorderFunction · 0.85
renderFilledBorderFunction · 0.85
getDrawUtilMethod · 0.80
drawRectFillMethod · 0.80
insetMethod · 0.80
clearBitmapModulationMethod · 0.80
drawBitmapSRMethod · 0.80
getBitmapResourceMethod · 0.80
setBitmapModulationMethod · 0.80
RectIClass · 0.50
sizeMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected