SimApi Timer seekToTimeByPosition

From SIMboxWiki
Jump to navigation Jump to search



Icon attributes.pngstatic void SimApi::Timer::seekToTimeByPosition(const int i_nSessionPositionInPercentage)

    Description

    Seeks to time by percentage of the total session time

    Parameters

    i_nSessionPositionInPercentage - The percentage of the total session time. The value can be in the range of 0-100.

    Remarks
    

Calling this function will publish a "TimeChanged" event with the new time values. The most common used of this function is in playback mode where a SIMBox Extension can "Jump" to a specific position in the scenario. Another possible use is a SIMBox extension that merges and synchronizes external information such as video with the SIMBox playback.


    Code Sample
    

//Assume we have an extension slider that was added to the playback Extension collection.
//We would like to have a slider in the toolbar that will set 
//the time according to the position of the slider. The slider position is percentage.

void PlaybackSliderExtension::OnSliderPositionChanged(int i_percentage)
{
	//seek to a new time in the session playback accroding to the percentage
	SimApi::Timer::seekToTimeByPosition(i_percentage);
}


    See Also

     getCurrentPosition

     getPosition

    Related Links

     Recommended: Simulation Time Overview