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

Method onRender

Engine/source/gui/buttons/guiCheckBoxCtrl.cpp:96–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94//-----------------------------------------------------------------------------
95
96void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect)
97{
98 // RLP/Sickhead NOTE: New/experimental code
99 // for notifying the GuiCheckBoxCtrl of changes
100 // to its mConsoleVariable's state.
101 if ( mConsoleVariable[0] )
102 {
103 bool stateOn = Con::getBoolVariable( mConsoleVariable );
104 if ( stateOn != mStateOn )
105 mStateOn = stateOn;
106 }
107
108 ColorI backColor = mActive ? mProfile->mFillColor : mProfile->mFillColorNA;
109 ColorI fontColor = mActive ? (mHighlighted ? mProfile->mFontColorHL : mProfile->mFontColor) : mProfile->mFontColorNA;
110 ColorI insideBorderColor = isFirstResponder() ? mProfile->mBorderColorHL : mProfile->mBorderColor;
111
112 // just draw the check box and the text:
113 S32 xOffset = 0;
114 GFX->getDrawUtil()->clearBitmapModulation();
115 if(mProfile->mBitmapArrayRects.size() >= 4)
116 {
117 S32 index = mStateOn;
118 if(!mActive)
119 {
120 if(mProfile->mBitmapArrayRects.size() >= 6)
121 {
122 // New style checkbox bitmap with 6 images
123 index = 4 + mStateOn;
124 }
125 else
126 {
127 // Old style checkbox bitmap
128 index = 2;
129 }
130 }
131 else if(mDepressed)
132 {
133 index += 2;
134 }
135 xOffset = mProfile->mBitmapArrayRects[0].extent.x + 2 + mIndent;
136 S32 y = (getHeight() - mProfile->mBitmapArrayRects[0].extent.y) / 2;
137 GFX->getDrawUtil()->drawBitmapSR(mProfile->getBitmapResource(), offset + Point2I(mIndent, y), mProfile->mBitmapArrayRects[index]);
138 }
139
140 if(mButtonText[0] != '\0')
141 {
142 GFX->getDrawUtil()->setBitmapModulation( fontColor );
143 renderJustifiedText(Point2I(offset.x + xOffset, offset.y),
144 Point2I(getWidth() - getHeight(), getHeight()),
145 mButtonText);
146 }
147 //render the children
148 renderChildControls(offset, updateRect);
149}
150
151//-----------------------------------------------------------------------------
152

Callers

nothing calls this directly

Calls 10

getBoolVariableFunction · 0.85
getWidthFunction · 0.85
clearBitmapModulationMethod · 0.80
getDrawUtilMethod · 0.80
drawBitmapSRMethod · 0.80
getBitmapResourceMethod · 0.80
setBitmapModulationMethod · 0.80
getHeightFunction · 0.50
Point2IClass · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected