UpdateAndDrawThreadsTests ClassDelta Engine Documentation
Here we experiment around with the Update and Draw threads proposed by case 4269 to be implemented into the EntitiesRunner and the AutofacStarter to be used by all apps. See discussion in forum.deltaengine.net, this class was not updated since. View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Tests.Entities UpdateAndDrawThreadsTests

Namespace: DeltaEngine.Tests.Entities
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public class UpdateAndDrawThreadsTests

The UpdateAndDrawThreadsTests type exposes the following members.

Constructors

  NameDescription
Public methodUpdateAndDrawThreadsTests
Initializes a new instance of the UpdateAndDrawThreadsTests class
Top
Methods

  NameDescription
Public methodUpdateAndDrawInParallel
Top
Examples

[Test, Ignore]
public void UpdateAndDrawInParallel()
{
    //const float UpdateTimeStep = 1 / 5.0f; 
    //const float RenderTimeStep = 1 / 60.0f; 
    var entities = new MockEntitiesRunner(typeof(MockUpdateBehavior));
    new StopwatchTime();
    var logger = new TextFileLogger();
    var state = new PositionEntity(Vector2D.Zero);
    //float drawTime = 0.0f; 
    //float updateTime = 0.0f; 
    //float accumulator = 0.0f; 
    while (GlobalTime.Current.Milliseconds < 1000)
    {
        Thread.Sleep(10);
        if (Time.Total > 0.2f && GlobalTime.Current.Milliseconds < 200)
            ThreadExtensions.Start(() => Thread.Sleep(500));
        GlobalTime.Current.Update();
        /*
        entities.State = UpdateDrawState.Update;
        accumulator += RenderTimeStep;
        while (accumulator >= UpdateTimeStep)
        {
            state.InvokeNextUpdateStarted();
            state.Update();
            updateTime += UpdateTimeStep;
            accumulator -= UpdateTimeStep;
        }
         */
        entities.UpdateAndDrawAllEntities(
            () => Logger.Info(
                "interpolatedPosition=" + state.Position +
                ", Global Time=" + GlobalTime.Current.Milliseconds + "ms" +
                ", Update Time=" + Time.Total +
                ", interpolation=" +EntitiesRunner.CurrentDrawInterpolation));
    }
    entities.Dispose();
    logger.Dispose();
}
See Also