Protocols
The following protocols are available globally.
-
The
NodeGeometryprotocol is used to give an object enough information to be placed in a scene and possibly rendered.Note
Any rendered
Nodemust have the camera property be non-nil. I’m still trying to figure out a nicer way to enforce this.discussion: Conforming to this protocol will grant access to most of the underlying maths required to render an object properly. Additionally, conforming to Tree will grant access to adding custom nodes to a
Scenegraph.Renderablehas all the required information to do both of the above, as well as draw a node using a customPipeline.See moreSeealso
RenderableandTree.Declaration
Swift
public protocol NodeGeometry: class
-
Any type that needs to be updated during the main game loop should implement the
See moreUpdateableprotocol.Declaration
Swift
public protocol Updateable: class, Tree
-
The
Treeprotocol is used by any object that wishes to be part of the tree hiearchy with the root more than likely being aScene.The basic implementation of this is in the
See moreNodeclass where the hiearchy is more or less a group of sets so that aNodecannot be added multiple times. It would still be possible to add a node to another parent but I’m not sure what will happen or if that even makes sense. Probably best to avoid doing stuff like that.Declaration
Swift
public protocol Tree: class
-
The
Renderableprotocol is required by an object that wishes to be rendered. Applying this protocol to an object should be sufficient for creating a custom pipeline.The following base classes conform to this protocol: - ShapeNode - SpriteNode - TextNode
discussion: Currently, this doesn’t need to be public as there’s no way to add a custom
Pipelineto theRendererat some point I will expose that. I’m just not entirely sure how I want to do it yet.See moreSeealso
NodeGeometryandTreeDeclaration
Swift
public protocol Renderable: NodeGeometry, Tree
Protocols Reference