UpdateAndDrawThreadsTests UpdateAndDrawInParallel Method Delta Engine Documentation

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

public void UpdateAndDrawInParallel()
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