C# Class FootballSimulationApp.FixedTimeStepSimulationLoop

Inheritance: ISimulationLoop
Datei anzeigen Open project: PurdueSIGAI/SoccerApp

Public Methods

Method Description
FixedTimeStepSimulationLoop ( System.TimeSpan targetElapsedTime, System.TimeSpan maxElapsedTime ) : System

After Start has been called, FixedTimeStepSimulationLoop will try to call the update function on the fixed interval specified by TargetElapsedTime. After this, if it is not time to call update again, the draw function is called. The game loop idles until the next time to call update.

SetDraw ( Action step ) : void

Sets the draw function that is called when the simulation needs to draw.

SetUpdate ( Action step ) : void

Sets the update function that is called when the simulation needs to update.

Start ( ) : void

Starts the game loop.

Tick ( ) : void

Calls update and draw when appropriate. This method should be called whenever the application does not have messages to process.

Private Methods

Method Description
GetElapsedTime ( ) : System.TimeSpan

Method Details

FixedTimeStepSimulationLoop() public method

After Start has been called, FixedTimeStepSimulationLoop will try to call the update function on the fixed interval specified by TargetElapsedTime. After this, if it is not time to call update again, the draw function is called. The game loop idles until the next time to call update.
public FixedTimeStepSimulationLoop ( System.TimeSpan targetElapsedTime, System.TimeSpan maxElapsedTime ) : System
targetElapsedTime System.TimeSpan The target time between calls to update.
maxElapsedTime System.TimeSpan The maximum amount of time between calls to draw.
return System

SetDraw() public method

Sets the draw function that is called when the simulation needs to draw.
public SetDraw ( Action step ) : void
step Action The draw function.
return void

SetUpdate() public method

Sets the update function that is called when the simulation needs to update.
public SetUpdate ( Action step ) : void
step Action The update function.
return void

Start() public method

Starts the game loop.
public Start ( ) : void
return void

Tick() public method

Calls update and draw when appropriate. This method should be called whenever the application does not have messages to process.
public Tick ( ) : void
return void