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

Method onRender

Engine/source/gui/editor/guiMenuBar.cpp:1296–1366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 12

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

Tested by

no test coverage detected