diff --git a/ArkKit/ark-render-kit/CanvasContext.swift b/ArkKit/ark-render-kit/CanvasContext.swift index 1f602e8..ad627eb 100644 --- a/ArkKit/ark-render-kit/CanvasContext.swift +++ b/ArkKit/ark-render-kit/CanvasContext.swift @@ -7,7 +7,7 @@ protocol CanvasContext { var arkView: (any ArkView)? { get } var memo: [EntityID: [RenderableComponentType: (any RenderableComponent, any Renderable)]] { get } - func getFlatCanvas() -> ArkFlatCanvas + func getFlatCanvas() -> any Canvas func render(_ canvas: any Canvas, using renderer: any RenderableBuilder) } @@ -62,7 +62,7 @@ class ArkCanvasContext: CanvasContext { } /// Outputs a logical canvas with the relevant entities in the canvas and their renderable components only - func getFlatCanvas() -> ArkFlatCanvas { + func getFlatCanvas() -> any Canvas { var arkCanvas = ArkFlatCanvas() for renderableCompType in ArkCanvasSystem.renderableComponentTypes { let renderableEntities = ecs.getEntities(with: [renderableCompType]) diff --git a/ArkKit/ark-render-kit/canvas/Canvas.swift b/ArkKit/ark-render-kit/canvas/Canvas.swift index a572f4c..6ed3f0b 100644 --- a/ArkKit/ark-render-kit/canvas/Canvas.swift +++ b/ArkKit/ark-render-kit/canvas/Canvas.swift @@ -22,4 +22,7 @@ protocol Canvas { typealias RenderableComponentType = ObjectIdentifier typealias CanvasElements = [EntityID: [RenderableComponentType: any RenderableComponent]] var canvasElements: CanvasElements { get } + mutating func addEntityRenderableToCanvas(entityId: EntityID, + componentType: RenderableComponentType, + renderableComponent: any RenderableComponent) }