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

Method onRender

Engine/source/Verve/GUI/VTimeLineControl.cpp:272–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272void VTimeLineControl::onRender( Point2I offset, const RectI &updateRect )
273{
274 if ( !mController )
275 {
276 // Default Render.
277 Parent::onRender( offset, updateRect );
278
279 // Quit.
280 return;
281 }
282
283 // Render Properties.
284 const S32 tickOffset = toPoint( 0 );
285 const S32 timeLineWidth = toPoint( mController->getDuration() ) - tickOffset;
286 const F32 tickStep = 0.5f;
287 const S32 tickInterval = ( mIsController ) ? getWidth() : timeLineWidth;
288 const S32 tickIntervalCount = ( S32 )mFloor( tickInterval / ( gUnitsPerSec * tickStep ) ) + 1;
289
290 // Tick Render Proeprties.
291 const Point2I tickExtent( 0, getHeight() - 1 );
292
293 // Text Render Properties.
294 const Point2I textExtent( gUnitsPerSec, mProfile->mFontSize );
295 const Point2I textOffset( 4, -mProfile->mFontSize );
296
297 // Render Border.
298 GFX->getDrawUtil()->drawRectFill( RectI( offset + Point2I( tickOffset + 1, 1 ), Point2I( timeLineWidth - 1, getHeight() - 1 ) ), mProfile->mFillColorHL );
299
300 // Font Color.
301 GFX->getDrawUtil()->setBitmapModulation( mProfile->mFontColor );
302
303 for ( S32 i = 0; i < tickIntervalCount; i++ )
304 {
305 // Tick Position.
306 const Point2I tickPosition = offset + Point2I( tickOffset + i * ( gUnitsPerSec * tickStep ), 0 );
307
308 // Line Color.
309 const ColorI lineColor = ( ( i % 2 ) ) ? mProfile->mBorderColorHL : mProfile->mBorderColor;
310
311 // Draw Line.
312 GFX->getDrawUtil()->drawLine( tickPosition, tickPosition + tickExtent, lineColor );
313
314 if ( mIsController )
315 {
316 // Render Times.
317 renderJustifiedText( tickPosition + tickExtent + textOffset, textExtent, avar( "%.2f", ( F32 )( i * tickStep ) ) );
318 }
319 }
320
321 // Render Children
322 renderChildControls( offset, updateRect );
323
324 if ( mSelection.Active )
325 {
326 // Selection Width.
327 const S32 selectionWidth = mCeil( mAbs( toPoint( mSelection.EndTime ) - toPoint( mSelection.StartTime ) ) );
328
329 // Selection Position.

Callers

nothing calls this directly

Calls 15

getWidthFunction · 0.85
mFloorFunction · 0.85
avarFunction · 0.85
mCeilFunction · 0.85
mAbsFunction · 0.85
dSprintfFunction · 0.85
getMaxFunction · 0.85
drawRectFillMethod · 0.80
getDrawUtilMethod · 0.80
setBitmapModulationMethod · 0.80
getStrWidthMethod · 0.80
getHeightFunction · 0.50

Tested by

no test coverage detected