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

Method onRender

Engine/source/gui/containers/guiPaneCtrl.cpp:187–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185//-----------------------------------------------------------------------------
186
187void GuiPaneControl::onRender(Point2I offset, const RectI &updateRect)
188{
189 // Render our awesome little doogong
190 if(mProfile->mBitmapArrayRects.size() >= 2 && mCollapsable)
191 {
192 S32 idx = mCollapsed ? 0 : 1;
193
194 GFX->getDrawUtil()->clearBitmapModulation();
195 GFX->getDrawUtil()->drawBitmapStretchSR(
196 mProfile->getBitmapResource(),
197 RectI(offset, mProfile->mBitmapArrayRects[idx].extent),
198 mProfile->mBitmapArrayRects[idx]
199 );
200
201 }
202
203 S32 textWidth = 0;
204
205 if(!mBarBehindText)
206 {
207 GFX->getDrawUtil()->setBitmapModulation((mMouseOver ? mProfile->mFontColorHL : mProfile->mFontColor));
208 textWidth = GFX->getDrawUtil()->drawText(
209 mProfile->mFont,
210 Point2I(mThumbSize.x, 0) + offset,
211 mCaption,
212 mProfile->mFontColors
213 );
214 }
215
216
217 // Draw our little bar, too
218 if(mProfile->mBitmapArrayRects.size() >= 5)
219 {
220 GFX->getDrawUtil()->clearBitmapModulation();
221
222 S32 barStart = mThumbSize.x + offset.x + textWidth;
223 S32 barTop = mThumbSize.y/2 + offset.y - mProfile->mBitmapArrayRects[3].extent.y /2;
224
225 Point2I barOffset(barStart, barTop);
226
227 // Draw the start of the bar...
228 GFX->getDrawUtil()->drawBitmapStretchSR(
229 mProfile->getBitmapResource(),
230 RectI(barOffset, mProfile->mBitmapArrayRects[2].extent),
231 mProfile->mBitmapArrayRects[2]
232 );
233
234 // Now draw the middle...
235 barOffset.x += mProfile->mBitmapArrayRects[2].extent.x;
236
237 S32 barMiddleSize = (getExtent().x - (barOffset.x - offset.x)) - mProfile->mBitmapArrayRects[4].extent.x;
238
239 if(barMiddleSize>0)
240 {
241 // We have to do this inset to prevent nasty stretching artifacts
242 RectI foo = mProfile->mBitmapArrayRects[3];
243 foo.inset(1,0);
244

Callers

nothing calls this directly

Calls 10

clearBitmapModulationMethod · 0.80
getDrawUtilMethod · 0.80
drawBitmapStretchSRMethod · 0.80
getBitmapResourceMethod · 0.80
setBitmapModulationMethod · 0.80
insetMethod · 0.80
RectIClass · 0.50
Point2IClass · 0.50
sizeMethod · 0.45
drawTextMethod · 0.45

Tested by

no test coverage detected