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

Method advanceTime

Engine/source/gui/containers/guiAutoScrollCtrl.cpp:273–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

271//-----------------------------------------------------------------------------
272
273void GuiAutoScrollCtrl::advanceTime( F32 timeDelta )
274{
275 if( mCurrentPhase == PhaseComplete )
276 return;
277
278 // Wait out initial delay.
279
280 if( ( mCurrentTime + timeDelta ) < mStartDelay)
281 {
282 mCurrentTime += timeDelta;
283 return;
284 }
285
286 // Start scrolling if we haven't already.
287
288 if( mCurrentPhase == PhaseInitial )
289 {
290 onStart_callback();
291 mCurrentPhase = PhaseScrolling;
292 }
293
294 GuiControl* control = static_cast< GuiControl* >( at( 0 ) );
295 if( !control ) // Should not happen.
296 return;
297
298 // If not yet complete, scroll some more.
299
300 if( !_isScrollComplete() )
301 {
302 U32 axis = _getScrollAxis();
303 F32 amount = _getScrollAmount();
304
305 mCurrentPosition += amount * timeDelta;
306 Point2I newPosition = control->getPosition();
307 newPosition[ axis ] = mCurrentPosition;
308
309 control->setPosition( newPosition );
310 }
311 else
312 {
313 mCurrentTime += timeDelta;
314
315 if( mCurrentPhase != PhaseComplete && mCurrentPhase != PhaseWait )
316 {
317 if( mCurrentPhase != PhaseWait )
318 {
319 onComplete_callback();
320 mCurrentPhase = PhaseComplete;
321 }
322
323 mCompleteTime = mCurrentTime;
324 }
325
326 // Reset, if looping.
327
328 if( mIsLooping )
329 {
330 // Wait out reset time and restart.

Callers 1

updateThreadsMethod · 0.45

Calls 4

_getScrollAxisFunction · 0.85
_getScrollAmountFunction · 0.85
getPositionMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected