Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
ISortableProvider.h File Reference

Interface for components that provide sorting order. More...

Classes

class  ISortableProvider

Detailed Description

Interface for components that provide sorting order.

Implement this interface on any component to have Standard2DRenderer automatically include the object in sorting. No callback registration needed.

Implementing the interface is not enough on its own: the renderer discovers it through ComponentInterfaceAdapters, so each component must also register an adapter from its StaticType to this interface. Do that once, from the package's registration path:

MyComponent::StaticType,
[](DekiComponent* c) -> void* {
return static_cast<ISortableProvider*>(static_cast<MyComponent*>(c));
});
Registry for extracting interfaces from components without RTTI or vtable changes.
Base class for all components (data-only).
Definition DekiComponent.h:51
Definition ISortableProvider.h:36
static constexpr uint32_t InterfaceID
Definition ISortableProvider.h:38
void Register(uint32_t interfaceId, ComponentType componentType, InterfaceAdapter adapter)

This block used to show a QueryInterface override calling DekiComponent::QueryInterface(id). DekiComponent has no such method and never has — following the example produced a compile error on the first custom implementation. The adapter registry exists precisely so DekiComponent needs no virtual for this.