Map
public struct Map : LayerContainer, Loadable, MutablePropertied
Represents a Tiled map which can be loaded from a Tiled tmx
file (other Tiled formats can be supported in the future, such as JSON). It contains the root collection of Layer
s as well as carrying the references to the TileSet
s used by the Map
-
The size of the map in tiles
Declaration
Swift
public let mapSize: TileGridSize
-
The size of a tile in pixels
Declaration
Swift
public let tileSize: PixelSize
-
Properties of the map
Declaration
Swift
public var properties: Properties
-
The size of the map in pixels
Declaration
Swift
public var pixelSize: PixelSize { get }
-
The orientation of the map
Declaration
Swift
public var orientation: Orientation
-
The rendering order the map was designed in
Declaration
Swift
public var renderingOrder: RenderingOrder
-
The color that should be used to render the background of the map
Declaration
Swift
public var backgroundColor: Color?
-
The various layers in the map
Declaration
Swift
public var layers: [Layer]
-
The tilesets the map uses
Declaration
Swift
public var tileSets: [TileSet] { get }
-
Creates a new instance of a map
Declaration
Swift
public init(with mapSize: TileGridSize, and tileSize: PixelSize, orientation: Orientation, renderingOrder: RenderingOrder)
Parameters
mapSize
The size of the map in tiles
tileSize
The size of tiles in the map (pixel dimensions)
orientation
The
Orientation
of the maprenderingOrder
The
RenderingOrder
of the map -
Creates and returns an instance of
MapLoader
which will load maps from Tiled tmx filesDeclaration
Swift
public static func loader(for project: Project) -> ResourceLoader
Parameters
project
The project the
Map
will be loaded intoReturn Value
An instance of
MapLoader
-
Maps should be cached, as they are value types a new instance is created anyway so there will not be unintended side effects
Declaration
Swift
public let cache: Bool
-
Returns
self
as it is a value typeDeclaration
Swift
public func newInstance() -> Map
Return Value
This value