ObjectFactory

public protocol ObjectFactory : Producer

Tile factories create the sprites that will be rendered for tiles

  • Creates a point object

    Declaration

    Swift

    func make(pointFor object: ObjectProtocol, in map: Map, from project: Project) throws -> EngineType.PointObjectType?

    Parameters

    object

    The meta-data for the object

    map

    The map the object is in

    project

    The project the map was loaded from

  • Creates a rectangle object of the specified size

    Declaration

    Swift

    func make(rectangleOf size: Size, at angle: Double, for object: ObjectProtocol, in map: Map, from project: Project) throws -> EngineType.RectangleObjectType?

    Parameters

    size

    The Size of the rectangle

    angle

    The angle the rectangle should be displayed in (in degrees)

    object

    The meta-data about the object

    map

    The map the object is in

    project

    The project content is being loaded from

  • Creates a ellipse object of the specified size

    Declaration

    Swift

    func make(ellipseOf size: Size, at angle: Double, for object: ObjectProtocol, in map: Map, from project: Project) throws -> EngineType.EllipseObjectType?

    Parameters

    size

    The Size of the ellipse

    angle

    The angle the ellipse should be displayed in (in degrees)

    object

    The meta-data about the object

    map

    The map the object is in

    project

    The project content is being loaded from

  • Creates a sprite for the specified tile

    Declaration

    Swift

    func make(spriteWith tileId: TileGID, of size: Size, at angle: Double, with tiles: MapTiles<EngineType>, for object: ObjectProtocol, in map: Map, from project: Project) throws -> EngineType.SpriteType?

    Parameters

    tileId

    The Gid of the tile

    size

    The size of the sprite

    angle

    The angle the sprite should be displayed at

    tiles

    The tiles loaded by the map (indexable by GID)

    object

    The meta-data about the object

    map

    The map the object is in

    project

    The project the map was loaded from

  • Creates a text object

    Declaration

    Swift

    func make(textWith string: String, of size: Size, at angle: Double, with style: TextStyle, for object: ObjectProtocol, in map: Map, from project: Project) throws -> EngineType.TextObjectType?

    Parameters

    string

    The string to display

    size

    The size of the clipping rectangle of the text

    angle

    The angle the text should be displayed at

    style

    The style the text should be rendered in

    object

    The meta-data about the object

    map

    The map the object is in

    project

    The project the map was loaded from

  • Creates a polyline (non-closed path) object

    Declaration

    Swift

    func make(polylineWith path: Path, at angle: Double, for object: ObjectProtocol, in map: Map, from project: Project) throws -> EngineType.PolylineObjectType?

    Parameters

    path

    The points of the path

    angle

    The angle the object should be shown at

    object

    Meta-data about the object

    map

    The map the object is in

    project

    The project the map was loaded from

  • Creates a polygon (closed path) object

    Declaration

    Swift

    func make(polygonWith path: Path, at angle: Double, for object: ObjectProtocol, in map: Map, from project: Project) throws -> EngineType.PolygonObjectType?

    Parameters

    path

    The points of the path

    angle

    The angle the object should be shown at

    object

    Meta-data about the object

    map

    The map the object is in

    project

    The project the map was loaded from