From 4dd73347e61d7f2f3a6e77fdb2ecf3e5cedb0234 Mon Sep 17 00:00:00 2001 From: Laszlo Paillat Date: Sun, 15 Dec 2019 14:16:38 +0100 Subject: [PATCH] renamed IRunner, IRunnable and DefaultRunner to more explicit IParallelRunner, IParallelRunnable and DefaultParallelRunner --- .../DefaultEcs.Benchmark/DefaultEcs/System.cs | 8 +++---- .../DoubleComponentEntityEnumeration.cs | 6 ++--- .../SingleComponentEntityEnumeration.cs | 8 +++---- .../System/AComponentSystemTest.cs | 4 ++-- .../System/AEntitySystemTest.cs | 6 ++--- .../System/ParallelSystemTest.cs | 10 ++++---- ...erTest.cs => DefaultParallelRunnerTest.cs} | 4 ++-- source/DefaultEcs/DefaultEcs.Release.csproj | 4 ++-- source/DefaultEcs/System/AComponentSystem.cs | 14 +++++------ source/DefaultEcs/System/AEntitySystem.cs | 18 +++++++------- source/DefaultEcs/System/ParallelSystem.cs | 22 ++++++++--------- ...aultRunner.cs => DefaultParallelRunner.cs} | 24 +++++++++---------- .../{IRunnable.cs => IParallelRunnable.cs} | 2 +- .../DefaultEcs/Threading/IParallelRunner.cs | 21 ++++++++++++++++ source/DefaultEcs/Threading/IRunner.cs | 21 ---------------- source/Sample/DefaultBrick/DefaultGame.cs | 4 ++-- .../DefaultBrick/System/PositionSystem.cs | 2 +- .../DefaultBrick/System/VelocitySystem.cs | 2 +- source/Sample/DefaultSlap/DefaultGame.cs | 4 ++-- source/Sample/DefaultSlap/System/AISystem.cs | 2 +- .../DefaultSlap/System/PositionSystem.cs | 2 +- 21 files changed, 94 insertions(+), 94 deletions(-) rename source/DefaultEcs.Test/Threading/{DefaultRunnerTest.cs => DefaultParallelRunnerTest.cs} (67%) rename source/DefaultEcs/Threading/{DefaultRunner.cs => DefaultParallelRunner.cs} (77%) rename source/DefaultEcs/Threading/{IRunnable.cs => IParallelRunnable.cs} (91%) create mode 100644 source/DefaultEcs/Threading/IParallelRunner.cs delete mode 100644 source/DefaultEcs/Threading/IRunner.cs diff --git a/source/DefaultEcs.Benchmark/DefaultEcs/System.cs b/source/DefaultEcs.Benchmark/DefaultEcs/System.cs index c2d60c55..76a8709d 100644 --- a/source/DefaultEcs.Benchmark/DefaultEcs/System.cs +++ b/source/DefaultEcs.Benchmark/DefaultEcs/System.cs @@ -36,7 +36,7 @@ private struct Speed private sealed class TestSystem : AEntitySystem { - public TestSystem(World world, IRunner runner) + public TestSystem(World world, IParallelRunner runner) : base(world.GetEntities().With().With().AsSet(), runner) { } @@ -52,7 +52,7 @@ protected override void Update(float state, in Entity entity) private sealed class Test2System : AEntitySystem { - public Test2System(World world, IRunner runner) + public Test2System(World world, IParallelRunner runner) : base(world.GetEntities().With().With().AsSet(), runner) { } @@ -102,7 +102,7 @@ public void Dispose() } private World _world; - private DefaultRunner _runner; + private DefaultParallelRunner _runner; private ISystem _systemSingle; private ISystem _system; private ISystem _system2Single; @@ -116,7 +116,7 @@ public void Dispose() public void Setup() { _world = new World(EntityCount); - _runner = new DefaultRunner(Environment.ProcessorCount); + _runner = new DefaultParallelRunner(Environment.ProcessorCount); _systemSingle = new TestSystem(_world, null); _system = new TestSystem(_world, _runner); _system2Single = new Test2System(_world, null); diff --git a/source/DefaultEcs.Benchmark/Performance/DoubleComponentEntityEnumeration.cs b/source/DefaultEcs.Benchmark/Performance/DoubleComponentEntityEnumeration.cs index e754e5db..279ff28a 100644 --- a/source/DefaultEcs.Benchmark/Performance/DoubleComponentEntityEnumeration.cs +++ b/source/DefaultEcs.Benchmark/Performance/DoubleComponentEntityEnumeration.cs @@ -30,7 +30,7 @@ private struct DefaultPosition private sealed class DefaultEcsSystem : AEntitySystem { - public DefaultEcsSystem(DefaultWorld world, IRunner runner) + public DefaultEcsSystem(DefaultWorld world, IParallelRunner runner) : base(world.GetEntities().With().With().AsSet(), runner) { } @@ -84,7 +84,7 @@ protected override void Execute(EntitasEntity entity) private DefaultWorld _defaultWorld; private DefaultEntitySet _defaultEntitySet; private DefaultEcsSystem _defaultSystem; - private DefaultRunner _defaultRunner; + private DefaultParallelRunner _defaultRunner; private DefaultEcsSystem _defaultMultiSystem; private EntitiasWorld _entitasWorld; @@ -100,7 +100,7 @@ public void Setup() _defaultWorld = new DefaultWorld(EntityCount); _defaultEntitySet = _defaultWorld.GetEntities().With().With().AsSet(); _defaultSystem = new DefaultEcsSystem(_defaultWorld); - _defaultRunner = new DefaultRunner(Environment.ProcessorCount); + _defaultRunner = new DefaultParallelRunner(Environment.ProcessorCount); _defaultMultiSystem = new DefaultEcsSystem(_defaultWorld, _defaultRunner); _entitasWorld = new Context(2, () => new EntitasEntity()); diff --git a/source/DefaultEcs.Benchmark/Performance/SingleComponentEntityEnumeration.cs b/source/DefaultEcs.Benchmark/Performance/SingleComponentEntityEnumeration.cs index ff809118..9b7ea8fd 100644 --- a/source/DefaultEcs.Benchmark/Performance/SingleComponentEntityEnumeration.cs +++ b/source/DefaultEcs.Benchmark/Performance/SingleComponentEntityEnumeration.cs @@ -21,7 +21,7 @@ private struct DefaultComponent private sealed class DefaultEcsSystem : AEntitySystem { - public DefaultEcsSystem(DefaultWorld world, IRunner runner) + public DefaultEcsSystem(DefaultWorld world, IParallelRunner runner) : base(world.GetEntities().With().AsSet(), runner) { } @@ -40,7 +40,7 @@ protected override void Update(int state, ReadOnlySpan entities) private sealed class DefaultEcsComponentSystem : AComponentSystem { - public DefaultEcsComponentSystem(DefaultWorld world, IRunner runner) + public DefaultEcsComponentSystem(DefaultWorld world, IParallelRunner runner) : base(world, runner) { } @@ -80,7 +80,7 @@ protected override void Execute(EntitasEntity entity) private DefaultWorld _defaultWorld; private DefaultEntitySet _defaultEntitySet; private DefaultEcsSystem _defaultSystem; - private DefaultRunner _defaultRunner; + private DefaultParallelRunner _defaultRunner; private DefaultEcsSystem _defaultMultiSystem; private DefaultEcsComponentSystem _defaultComponentSystem; private DefaultEcsComponentSystem _defaultComponentMultiSystem; @@ -98,7 +98,7 @@ public void Setup() _defaultWorld = new DefaultWorld(EntityCount); _defaultEntitySet = _defaultWorld.GetEntities().With().AsSet(); _defaultSystem = new DefaultEcsSystem(_defaultWorld); - _defaultRunner = new DefaultRunner(Environment.ProcessorCount); + _defaultRunner = new DefaultParallelRunner(Environment.ProcessorCount); _defaultMultiSystem = new DefaultEcsSystem(_defaultWorld, _defaultRunner); _defaultComponentSystem = new DefaultEcsComponentSystem(_defaultWorld); _defaultComponentMultiSystem = new DefaultEcsComponentSystem(_defaultWorld, _defaultRunner); diff --git a/source/DefaultEcs.Test/System/AComponentSystemTest.cs b/source/DefaultEcs.Test/System/AComponentSystemTest.cs index f5cd7cf3..58d91d3d 100644 --- a/source/DefaultEcs.Test/System/AComponentSystemTest.cs +++ b/source/DefaultEcs.Test/System/AComponentSystemTest.cs @@ -14,7 +14,7 @@ public System(World world) : base(world) { } - public System(World world, IRunner runner) + public System(World world, IParallelRunner runner) : base(world, runner) { } @@ -86,7 +86,7 @@ public void Update_Should_not_call_update_When_disabled() [Fact] public void Update_with_runner_Should_call_update() { - using DefaultRunner runner = new DefaultRunner(2); + using DefaultParallelRunner runner = new DefaultParallelRunner(2); using World world = new World(3); Entity entity1 = world.CreateEntity(); diff --git a/source/DefaultEcs.Test/System/AEntitySystemTest.cs b/source/DefaultEcs.Test/System/AEntitySystemTest.cs index 9fc9dbff..75afbd8d 100644 --- a/source/DefaultEcs.Test/System/AEntitySystemTest.cs +++ b/source/DefaultEcs.Test/System/AEntitySystemTest.cs @@ -21,11 +21,11 @@ public System(World world) : base(world) { } - public System(EntitySet set, IRunner runner) + public System(EntitySet set, IParallelRunner runner) : base(set, runner) { } - public System(World world, IRunner runner) + public System(World world, IParallelRunner runner) : base(world, runner) { } @@ -184,7 +184,7 @@ public void Update_Should_not_call_update_When_disabled() [Fact] public void Update_with_runner_Should_call_update() { - using DefaultRunner runner = new DefaultRunner(2); + using DefaultParallelRunner runner = new DefaultParallelRunner(2); using World world = new World(4); Entity entity1 = world.CreateEntity(); diff --git a/source/DefaultEcs.Test/System/ParallelSystemTest.cs b/source/DefaultEcs.Test/System/ParallelSystemTest.cs index 224190dc..fc2867b4 100644 --- a/source/DefaultEcs.Test/System/ParallelSystemTest.cs +++ b/source/DefaultEcs.Test/System/ParallelSystemTest.cs @@ -16,7 +16,7 @@ public void ParallelSystem_Should_throw_When_systems_is_null() { ISystem[] systems = null; - Check.ThatCode(() => new ParallelSystem(Substitute.For(), systems)).Throws(); + Check.ThatCode(() => new ParallelSystem(Substitute.For(), systems)).Throws(); } [Fact] @@ -34,7 +34,7 @@ public void Update_Should_call_update_on_all_systems() using (ISystem system = new ParallelSystem( new ActionSystem(_ => mainDone = true), - new DefaultRunner(1), + new DefaultParallelRunner(1), new ActionSystem(_ => done1 = true), new ActionSystem(_ => done2 = true))) { @@ -54,7 +54,7 @@ public void Update_with_runner_Should_call_update_on_all_systems() bool done3 = false; bool done4 = false; - using (DefaultRunner runner = new DefaultRunner(2)) + using (DefaultParallelRunner runner = new DefaultParallelRunner(2)) using (ISystem system = new ParallelSystem( runner, new ActionSystem(_ => done1 = true), @@ -79,7 +79,7 @@ public void Update_with_runner_Should_not_call_update_on_any_systems_When_disabl bool done3 = false; bool done4 = false; - using (DefaultRunner runner = new DefaultRunner(2)) + using (DefaultParallelRunner runner = new DefaultParallelRunner(2)) using (ISystem system = new ParallelSystem( runner, new ActionSystem(_ => done1 = true), @@ -109,7 +109,7 @@ public void Dispose_Should_call_Dispose_on_all_systems() s1.When(s => s.Dispose()).Do(_ => done1 = true); s2.When(s => s.Dispose()).Do(_ => done2 = true); - ISystem system = new ParallelSystem(s1, Substitute.For(), s2); + ISystem system = new ParallelSystem(s1, Substitute.For(), s2); system.Dispose(); diff --git a/source/DefaultEcs.Test/Threading/DefaultRunnerTest.cs b/source/DefaultEcs.Test/Threading/DefaultParallelRunnerTest.cs similarity index 67% rename from source/DefaultEcs.Test/Threading/DefaultRunnerTest.cs rename to source/DefaultEcs.Test/Threading/DefaultParallelRunnerTest.cs index bac4f6ab..ce242001 100644 --- a/source/DefaultEcs.Test/Threading/DefaultRunnerTest.cs +++ b/source/DefaultEcs.Test/Threading/DefaultParallelRunnerTest.cs @@ -5,14 +5,14 @@ namespace DefaultEcs.Test.Threading { - public sealed class DefaultRunnerTest + public sealed class DefaultParallelRunnerTest { #region Tests [Fact] public void DefaultRunner_Should_throw_When_degreeOfParallelism_is_inferior_to_one() { - Check.ThatCode(() => new DefaultRunner(-1)).Throws(); + Check.ThatCode(() => new DefaultParallelRunner(-1)).Throws(); } #endregion diff --git a/source/DefaultEcs/DefaultEcs.Release.csproj b/source/DefaultEcs/DefaultEcs.Release.csproj index b57da151..eb92518a 100644 --- a/source/DefaultEcs/DefaultEcs.Release.csproj +++ b/source/DefaultEcs/DefaultEcs.Release.csproj @@ -17,14 +17,14 @@ 0.13.0 breaking change: -removed SystemRunner type, use DefaultEcs.Threading.DefaultRunner instead +removed SystemRunner type, use DefaultEcs.Threading.DefaultParallelRunner instead removed ASystem type refactored EntitySetBuilder to a more fluent syntax, Build changed to AsSet, *Either<T1, T2>() replaced by *Either<T1>().Or<T2>() added World.GetDisabledEntities method to create EntitySet for disabled entities added DisabledAttribute to auto construct EntitySet of disabled entities for AEntitySystem added EntitySet.Contains method to check for an Entity inclusion -added IRunner to allow custom implementation to process AEntitySystem, AComponentSystem and ParallelSystem in parallel +added IParallelRunner to allow custom implementation to process AEntitySystem, AComponentSystem and ParallelSystem in parallel added Entity.World property fixed EntityCommandRecorder SetSameAs and Dispose command size diff --git a/source/DefaultEcs/System/AComponentSystem.cs b/source/DefaultEcs/System/AComponentSystem.cs index 91281372..c1c84f3f 100644 --- a/source/DefaultEcs/System/AComponentSystem.cs +++ b/source/DefaultEcs/System/AComponentSystem.cs @@ -13,7 +13,7 @@ public abstract class AComponentSystem : ISystem { #region Types - private class Runnable : IRunnable + private class Runnable : IParallelRunnable { private readonly AComponentSystem _system; @@ -38,7 +38,7 @@ public void Run(int index, int maxIndex) #region Fields - private readonly IRunner _runner; + private readonly IParallelRunner _runner; private readonly Runnable _runnable; private readonly ComponentPool _component; @@ -46,19 +46,19 @@ public void Run(int index, int maxIndex) #region Initialisation - private AComponentSystem(IRunner runner) + private AComponentSystem(IParallelRunner runner) { - _runner = runner ?? DefaultRunner.Default; + _runner = runner ?? DefaultParallelRunner.Default; _runnable = new Runnable(this); } /// - /// Initialise a new instance of the class with the given and . + /// Initialise a new instance of the class with the given and . /// /// The on which to process the update. - /// The used to process the update in parallel if not null. + /// The used to process the update in parallel if not null. /// is null. - protected AComponentSystem(World world, IRunner runner) + protected AComponentSystem(World world, IParallelRunner runner) : this(runner) { _component = ComponentManager.GetOrCreate(world?.WorldId ?? throw new ArgumentNullException(nameof(world))); diff --git a/source/DefaultEcs/System/AEntitySystem.cs b/source/DefaultEcs/System/AEntitySystem.cs index f7ba1f32..01bc8b1f 100644 --- a/source/DefaultEcs/System/AEntitySystem.cs +++ b/source/DefaultEcs/System/AEntitySystem.cs @@ -12,7 +12,7 @@ public abstract class AEntitySystem : ISystem { #region Types - private class Runnable : IRunnable + private class Runnable : IParallelRunnable { private readonly AEntitySystem _system; @@ -36,7 +36,7 @@ public void Run(int index, int maxIndex) #region Fields - private readonly IRunner _runner; + private readonly IParallelRunner _runner; private readonly Runnable _runnable; private readonly EntitySet _set; @@ -62,19 +62,19 @@ public event ActionIn EntityRemoved #region Initialisation - private AEntitySystem(IRunner runner) + private AEntitySystem(IParallelRunner runner) { - _runner = runner ?? DefaultRunner.Default; + _runner = runner ?? DefaultParallelRunner.Default; _runnable = new Runnable(this); } /// - /// Initialise a new instance of the class with the given and . + /// Initialise a new instance of the class with the given and . /// /// The on which to process the update. - /// The used to process the update in parallel if not null. + /// The used to process the update in parallel if not null. /// is null. - protected AEntitySystem(EntitySet set, IRunner runner) + protected AEntitySystem(EntitySet set, IParallelRunner runner) : this(runner) { _set = set ?? throw new ArgumentNullException(nameof(set)); @@ -94,9 +94,9 @@ protected AEntitySystem(EntitySet set) /// To create the inner , and attributes will be used. /// /// The from which to get the instances to process the update. - /// The used to process the update in parallel if not null. + /// The used to process the update in parallel if not null. /// is null. - protected AEntitySystem(World world, IRunner runner) + protected AEntitySystem(World world, IParallelRunner runner) : this(runner) { _set = EntitySetFactory.Create(GetType())(world ?? throw new ArgumentNullException(nameof(world))); diff --git a/source/DefaultEcs/System/ParallelSystem.cs b/source/DefaultEcs/System/ParallelSystem.cs index 8bbec160..fb465d08 100644 --- a/source/DefaultEcs/System/ParallelSystem.cs +++ b/source/DefaultEcs/System/ParallelSystem.cs @@ -14,7 +14,7 @@ public sealed class ParallelSystem : ISystem { #region Types - private class Runnable : IRunnable + private class Runnable : IParallelRunnable { private readonly ParallelSystem _system; @@ -44,7 +44,7 @@ public void Run(int index, int maxIndex) #region Fields - private readonly IRunner _runner; + private readonly IParallelRunner _runner; private readonly Runnable _runnable; private readonly ISystem _mainSystem; private readonly ISystem[] _systems; @@ -53,7 +53,7 @@ public void Run(int index, int maxIndex) #region Initialisation - private ParallelSystem(IRunner runner) + private ParallelSystem(IParallelRunner runner) { _runner = runner ?? throw new ArgumentNullException(nameof(runner)); _runnable = new Runnable(this); @@ -63,11 +63,11 @@ private ParallelSystem(IRunner runner) /// Initialises a new instance of the class. /// /// The instance to be updated on the calling thread. - /// The used to process the update in parallel if not null. + /// The used to process the update in parallel if not null. /// The instances. /// is null. /// is null. - public ParallelSystem(ISystem mainSystem, IRunner runner, IEnumerable> systems) + public ParallelSystem(ISystem mainSystem, IParallelRunner runner, IEnumerable> systems) : this(runner) { _mainSystem = mainSystem; @@ -78,33 +78,33 @@ public ParallelSystem(ISystem mainSystem, IRunner runner, IEnumerable class. /// /// The instance to be updated on the calling thread. - /// The used to process the update in parallel if not null. + /// The used to process the update in parallel if not null. /// The instances. /// is null. /// is null. - public ParallelSystem(ISystem mainSystem, IRunner runner, params ISystem[] systems) + public ParallelSystem(ISystem mainSystem, IParallelRunner runner, params ISystem[] systems) : this(mainSystem, runner, systems as IEnumerable>) { } /// /// Initialises a new instance of the class. /// - /// The used to process the update in parallel if not null. + /// The used to process the update in parallel if not null. /// The instances. /// is null. /// is null. - public ParallelSystem(IRunner runner, IEnumerable> systems) + public ParallelSystem(IParallelRunner runner, IEnumerable> systems) : this(null, runner, systems) { } /// /// Initialises a new instance of the class. /// - /// The used to process the update in parallel if not null. + /// The used to process the update in parallel if not null. /// The instances. /// is null. /// is null. - public ParallelSystem(IRunner runner, params ISystem[] systems) + public ParallelSystem(IParallelRunner runner, params ISystem[] systems) : this(runner, systems as IEnumerable>) { } diff --git a/source/DefaultEcs/Threading/DefaultRunner.cs b/source/DefaultEcs/Threading/DefaultParallelRunner.cs similarity index 77% rename from source/DefaultEcs/Threading/DefaultRunner.cs rename to source/DefaultEcs/Threading/DefaultParallelRunner.cs index 31ddc796..0cc210e4 100644 --- a/source/DefaultEcs/Threading/DefaultRunner.cs +++ b/source/DefaultEcs/Threading/DefaultParallelRunner.cs @@ -8,30 +8,30 @@ namespace DefaultEcs.Threading { /// - /// Represents an object used to run an by using multiple . + /// Represents an object used to run an by using multiple . /// - public sealed class DefaultRunner : IRunner + public sealed class DefaultParallelRunner : IParallelRunner { #region Fields - internal static readonly DefaultRunner Default = new DefaultRunner(1); + internal static readonly DefaultParallelRunner Default = new DefaultParallelRunner(1); private readonly CancellationTokenSource _disposeHandle; private readonly WorkerBarrier _barrier; private readonly Task[] _tasks; - private IRunnable _currentRunnable; + private IParallelRunnable _currentRunnable; #endregion #region Initialisation /// - /// Initialises a new instance of the class. + /// Initialises a new instance of the class. /// - /// The number of concurrent used to update an in parallel. + /// The number of concurrent used to update an in parallel. /// cannot be inferior to one. - public DefaultRunner(int degreeOfParallelism) + public DefaultParallelRunner(int degreeOfParallelism) { IEnumerable indices = degreeOfParallelism >= 1 ? Enumerable.Range(0, degreeOfParallelism - 1) : throw new ArgumentException("Argument cannot be inferior to one", nameof(degreeOfParallelism)); @@ -74,15 +74,15 @@ private void Update(object state) #region IRunner /// - /// Gets the degree of parallelism used to run an . + /// Gets the degree of parallelism used to run an . /// public int DegreeOfParallelism => _tasks.Length + 1; /// - /// Runs the provided . + /// Runs the provided . /// - /// The to run. - public void Run(IRunnable runnable) + /// The to run. + public void Run(IParallelRunnable runnable) { Volatile.Write(ref _currentRunnable, runnable); @@ -98,7 +98,7 @@ public void Run(IRunnable runnable) #region IDisposable /// - /// Releases all the resources used by the current instance. + /// Releases all the resources used by the current instance. /// public void Dispose() { diff --git a/source/DefaultEcs/Threading/IRunnable.cs b/source/DefaultEcs/Threading/IParallelRunnable.cs similarity index 91% rename from source/DefaultEcs/Threading/IRunnable.cs rename to source/DefaultEcs/Threading/IParallelRunnable.cs index 46b50fb8..d8baf78c 100644 --- a/source/DefaultEcs/Threading/IRunnable.cs +++ b/source/DefaultEcs/Threading/IParallelRunnable.cs @@ -3,7 +3,7 @@ /// /// Exposes a method to run a process in parallel. /// - public interface IRunnable + public interface IParallelRunnable { /// /// Runs the part out of of the process. diff --git a/source/DefaultEcs/Threading/IParallelRunner.cs b/source/DefaultEcs/Threading/IParallelRunner.cs new file mode 100644 index 00000000..31da4ca8 --- /dev/null +++ b/source/DefaultEcs/Threading/IParallelRunner.cs @@ -0,0 +1,21 @@ +using System; + +namespace DefaultEcs.Threading +{ + /// + /// Exposes a method to run in parallel a . + /// + public interface IParallelRunner : IDisposable + { + /// + /// Gets the degree of parallelism used to run an . + /// + int DegreeOfParallelism { get; } + + /// + /// Runs the provided . + /// + /// The to run. + void Run(IParallelRunnable runnable); + } +} diff --git a/source/DefaultEcs/Threading/IRunner.cs b/source/DefaultEcs/Threading/IRunner.cs deleted file mode 100644 index 3a7d2b54..00000000 --- a/source/DefaultEcs/Threading/IRunner.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace DefaultEcs.Threading -{ - /// - /// Exposes a method to run in parallel a . - /// - public interface IRunner : IDisposable - { - /// - /// Gets the degree of parallelism used to run an . - /// - int DegreeOfParallelism { get; } - - /// - /// Runs the provided . - /// - /// The to run. - void Run(IRunnable runnable); - } -} diff --git a/source/Sample/DefaultBrick/DefaultGame.cs b/source/Sample/DefaultBrick/DefaultGame.cs index 5a02fe10..9c03c145 100644 --- a/source/Sample/DefaultBrick/DefaultGame.cs +++ b/source/Sample/DefaultBrick/DefaultGame.cs @@ -22,7 +22,7 @@ public class DefaultGame : Game private readonly SoundEffect _breakSound; private readonly SoundEffect _bounceSound; private readonly World _world; - private readonly DefaultRunner _runner; + private readonly DefaultParallelRunner _runner; private readonly ISystem _system; #endregion @@ -52,7 +52,7 @@ public DefaultGame() _world = new World(1000); - _runner = new DefaultRunner(Environment.ProcessorCount); + _runner = new DefaultParallelRunner(Environment.ProcessorCount); _system = new SequentialSystem( new GameSystem(_world), new PlayerSystem(Window, _world), diff --git a/source/Sample/DefaultBrick/System/PositionSystem.cs b/source/Sample/DefaultBrick/System/PositionSystem.cs index 14d7c767..24f2feb5 100644 --- a/source/Sample/DefaultBrick/System/PositionSystem.cs +++ b/source/Sample/DefaultBrick/System/PositionSystem.cs @@ -8,7 +8,7 @@ namespace DefaultBrick.System { public sealed class PositionSystem : AEntitySystem { - public PositionSystem(World world, IRunner runner) + public PositionSystem(World world, IParallelRunner runner) : base(world.GetEntities().WhenAdded().WhenChanged().With().AsSet(), runner) { } diff --git a/source/Sample/DefaultBrick/System/VelocitySystem.cs b/source/Sample/DefaultBrick/System/VelocitySystem.cs index 3b3d787c..3a131ec1 100644 --- a/source/Sample/DefaultBrick/System/VelocitySystem.cs +++ b/source/Sample/DefaultBrick/System/VelocitySystem.cs @@ -8,7 +8,7 @@ namespace DefaultBrick.System { public sealed class VelocitySystem : AEntitySystem { - public VelocitySystem(World world, IRunner runner) + public VelocitySystem(World world, IParallelRunner runner) : base(world.GetEntities().With().With().AsSet(), runner) { } diff --git a/source/Sample/DefaultSlap/DefaultGame.cs b/source/Sample/DefaultSlap/DefaultGame.cs index 669d4005..54e59fc8 100644 --- a/source/Sample/DefaultSlap/DefaultGame.cs +++ b/source/Sample/DefaultSlap/DefaultGame.cs @@ -23,7 +23,7 @@ public class DefaultGame : Game private readonly SoundEffect _bounceSound; private readonly World _world; private readonly ISystem _system; - private readonly DefaultRunner _runner; + private readonly DefaultParallelRunner _runner; #endregion @@ -54,7 +54,7 @@ public DefaultGame() _world.SetMaximumComponentCount(1); - _runner = new DefaultRunner(Environment.ProcessorCount); + _runner = new DefaultParallelRunner(Environment.ProcessorCount); _system = new SequentialSystem( new PlayerSystem(Window, _world), new HitSystem(_world), diff --git a/source/Sample/DefaultSlap/System/AISystem.cs b/source/Sample/DefaultSlap/System/AISystem.cs index 8188bacb..3249d3fa 100644 --- a/source/Sample/DefaultSlap/System/AISystem.cs +++ b/source/Sample/DefaultSlap/System/AISystem.cs @@ -12,7 +12,7 @@ public sealed class AISystem : AEntitySystem { private readonly ThreadLocal _random; - public AISystem(World world, IRunner runner) + public AISystem(World world, IParallelRunner runner) : base(world.GetEntities().With().With().With().AsSet(), runner) { _random = new ThreadLocal(() => new Random()); diff --git a/source/Sample/DefaultSlap/System/PositionSystem.cs b/source/Sample/DefaultSlap/System/PositionSystem.cs index 974ad001..de48a725 100644 --- a/source/Sample/DefaultSlap/System/PositionSystem.cs +++ b/source/Sample/DefaultSlap/System/PositionSystem.cs @@ -9,7 +9,7 @@ namespace DefaultSlap.System [With(typeof(Position), typeof(PositionFloat))] public sealed class PositionSystem : AEntitySystem { - public PositionSystem(World world, IRunner runner) + public PositionSystem(World world, IParallelRunner runner) : base(world, runner) { }