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

Interface for components that provide clip rectangles. More...

Classes

class  IClipProvider

Detailed Description

Interface for components that provide clip rectangles.

Implement this interface on any component to have Standard2DRenderer automatically push/pop clip rects during rendering. No pass 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<IClipProvider*>(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 IClipProvider.h:36
static constexpr uint32_t InterfaceID
Definition IClipProvider.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.