From f31b84f5191234274166e159c98719a2e617e19e Mon Sep 17 00:00:00 2001 From: Syntriax Date: Sun, 1 Jun 2025 14:18:50 +0300 Subject: [PATCH] refactor: renamed sort comparer names to be more readable --- Engine.Core/Systems/DrawManager.cs | 8 ++++---- Engine.Core/Systems/UpdateManager.cs | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Engine.Core/Systems/DrawManager.cs b/Engine.Core/Systems/DrawManager.cs index 4045c23..0bcc78d 100644 --- a/Engine.Core/Systems/DrawManager.cs +++ b/Engine.Core/Systems/DrawManager.cs @@ -4,11 +4,11 @@ namespace Syntriax.Engine.Core; public class DrawManager : UniverseObject { - private static Comparer SortByPriority() => Comparer.Create((x, y) => y.Priority.CompareTo(x.Priority)); + private static Comparer SortByAscendingPriority() => Comparer.Create((x, y) => x.Priority.CompareTo(y.Priority)); - private readonly ActiveBehaviourCollectorSorted preDrawEntities = new() { SortBy = SortByPriority() }; - private readonly ActiveBehaviourCollectorSorted drawEntities = new() { SortBy = SortByPriority() }; - private readonly ActiveBehaviourCollectorSorted postDrawEntities = new() { SortBy = SortByPriority() }; + private readonly ActiveBehaviourCollectorSorted preDrawEntities = new() { SortBy = SortByAscendingPriority() }; + private readonly ActiveBehaviourCollectorSorted drawEntities = new() { SortBy = SortByAscendingPriority() }; + private readonly ActiveBehaviourCollectorSorted postDrawEntities = new() { SortBy = SortByAscendingPriority() }; private void OnPreDraw(IUniverse sender) { diff --git a/Engine.Core/Systems/UpdateManager.cs b/Engine.Core/Systems/UpdateManager.cs index 2b204dd..80204e7 100644 --- a/Engine.Core/Systems/UpdateManager.cs +++ b/Engine.Core/Systems/UpdateManager.cs @@ -4,12 +4,12 @@ namespace Syntriax.Engine.Core; public class UpdateManager : UniverseObject { - private static Comparer SortByPriority() => Comparer.Create((x, y) => y.Priority.CompareTo(x.Priority)); + private static Comparer SortByDescendingPriority() => Comparer.Create((x, y) => y.Priority.CompareTo(x.Priority)); - private readonly ActiveBehaviourCollectorSorted firstFrameUpdates = new() { SortBy = SortByPriority() }; - private readonly ActiveBehaviourCollectorSorted preUpdateEntities = new() { SortBy = SortByPriority() }; - private readonly ActiveBehaviourCollectorSorted updateEntities = new() { SortBy = SortByPriority() }; - private readonly ActiveBehaviourCollectorSorted postUpdateEntities = new() { SortBy = SortByPriority() }; + private readonly ActiveBehaviourCollectorSorted firstFrameUpdates = new() { SortBy = SortByDescendingPriority() }; + private readonly ActiveBehaviourCollectorSorted preUpdateEntities = new() { SortBy = SortByDescendingPriority() }; + private readonly ActiveBehaviourCollectorSorted updateEntities = new() { SortBy = SortByDescendingPriority() }; + private readonly ActiveBehaviourCollectorSorted postUpdateEntities = new() { SortBy = SortByDescendingPriority() }; private readonly List toCallFirstFrameUpdates = new(32);