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

Method renderButton

Engine/source/gui/buttons/guiIconButtonCtrl.cpp:220–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
221{
222 bool highlight = mHighlighted;
223 bool depressed = mDepressed;
224
225 ColorI fontColor = mActive ? (highlight ? mProfile->mFontColorHL : mProfile->mFontColor) : mProfile->mFontColorNA;
226
227 RectI boundsRect(offset, getExtent());
228
229 GFXDrawUtil *drawer = GFX->getDrawUtil();
230
231 if (mDepressed || mStateOn)
232 {
233 // If there is a bitmap array then render using it.
234 // Otherwise use a standard fill.
235 if(mProfile->mUseBitmapArray && mProfile->mBitmapArrayRects.size())
236 renderBitmapArray(boundsRect, statePressed);
237 else
238 renderSlightlyLoweredBox(boundsRect, mProfile);
239 }
240 else if(mHighlighted && mActive)
241 {
242 // If there is a bitmap array then render using it.
243 // Otherwise use a standard fill.
244 if (mProfile->mUseBitmapArray && mProfile->mBitmapArrayRects.size())
245 {
246 renderBitmapArray(boundsRect, stateMouseOver);
247 }
248 else
249 {
250 drawer->drawRectFill(boundsRect, mProfile->mFillColorHL);
251 drawer->drawRect(boundsRect, mProfile->mBorderColorHL);
252 }
253 }
254 else
255 {
256 // If there is a bitmap array then render using it.
257 // Otherwise use a standard fill.
258 if(mProfile->mUseBitmapArray && mProfile->mBitmapArrayRects.size())
259 {
260 if(mActive)
261 renderBitmapArray(boundsRect, stateNormal);
262 else
263 renderBitmapArray(boundsRect, stateDisabled);
264 }
265 else
266 {
267 if (mActive)
268 {
269 drawer->drawRectFill(boundsRect, mProfile->mFillColor);
270 drawer->drawRect(boundsRect, mProfile->mBorderColor);
271 }
272 else
273 {
274 drawer->drawRectFill(boundsRect, mProfile->mFillColorNA);
275 drawer->drawRect(boundsRect, mProfile->mBorderColorNA);
276 }
277 }

Callers

nothing calls this directly

Calls 15

renderSlightlyLoweredBoxFunction · 0.85
getWidthFunction · 0.85
mAbsFunction · 0.85
getDrawUtilMethod · 0.80
drawRectFillMethod · 0.80
drawRectMethod · 0.80
clearBitmapModulationMethod · 0.80
drawBitmapStretchMethod · 0.80
setBitmapModulationMethod · 0.80
Point2IClass · 0.50
getHeightFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected