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

Method onRender

Engine/modules/Verve/GUI/VTimeLineControl.cpp:271–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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