Skip to content

Give each phase interface its own order member instead of a shared IOrderable - #487

Merged
stanoddly merged 1 commit into
mainfrom
phase-specific-order-members
Sep 10, 2026
Merged

Give each phase interface its own order member instead of a shared IOrderable#487
stanoddly merged 1 commit into
mainfrom
phase-specific-order-members

Conversation

@botoddly

Copy link
Copy Markdown
Collaborator

IOrderable gave rendering and updating one shared Order. A class implementing both IRenderer<T> and IUpdatable could therefore only state one position, which is the wrong coupling: those are two independent phases. IUpdatable did not even inherit the interface, so the update registry had to type-test each service at every comparison and fall back to 0.

Each phase interface now names its own order.

  • IUpdatable declares int UpdateOrder => 0;
  • IRenderer<in TRenderContext> declares int RenderOrder => 0;, next to the ViewScope => default member already there
  • IOrderable is deleted

Both registry comparisons collapse to a direct property read, and the runtime type test disappears:

AddRegistry<IRenderer<BasicRenderContext>>(static (left, right) => left.RenderOrder.CompareTo(right.RenderOrder));
AddRegistry<IUpdatable>(static (left, right) => left.UpdateOrder.CompareTo(right.UpdateOrder));

UiRenderer, PencuilRenderer and TestRenderer expose RenderOrder; UiUpdateSystem exposes UpdateOrder and drops IOrderable. Their constructor parameters follow, matching the renderOrder and updateOrder names the extension methods already used at the call sites.

Input

Input ordering is not a property of a handler object. It is an argument to each subscription, and a single system commonly subscribes to several events at once, so there is no interface to move a member onto. The value was named priority in the service interfaces but inputOrder at every call site and in the docs. It is now order throughout, giving all three phases one vocabulary: IMouseService, IKeyboardService, IGamepadService, ITextInputService and their implementations. PriorityEventHandlers and ViewScopedPriorityEventHandlers become OrderedEventHandlers and ViewScopedOrderedEventHandlers. The priority queue in Pixely.PathFinding is untouched, that is a different meaning of the word.

Breaking changes

  • Downstream subrenderer interfaces that inherited IOrderable must declare their own int Order => 0;. docs/subrenderers.md shows this and explains why there is no shared ordering interface.
  • Callers passing the input order as a named argument priority: must use order:.

Testing

dotnet build clean, dotnet test green across all 13 test projects.

@stanoddly
stanoddly enabled auto-merge (squash) September 10, 2026 07:30
@stanoddly
stanoddly merged commit 8f25c39 into main Sep 10, 2026
1 check passed
@stanoddly
stanoddly deleted the phase-specific-order-members branch September 10, 2026 07:31
@github-actions

Copy link
Copy Markdown

✅ Development package Pixely 0.0.37 published successfully.

Workflow run (attempt 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants