Class TCastleTiledMapData
Unit
CastleTiledMap
Declaration
type TCastleTiledMapData = class(TObject)
Description
Loading and manipulating "Tiled" map files (http://mapeditor.org).
Hierarchy
- TObject
- TCastleTiledMapData
Overview
Nested Classes and Records
Nested Types
Methods
Properties
Description
Nested Types
 |
TCompressionType = (...); |
Values
|
 |
TEncodingType = (...); |
Values
|
 |
TLayerList = specialize TObjectList<TLayer>; |
List of layers.
|
 |
TMapOrientation = (...); |
Values
-
moOrthogonal
-
moIsometric
-
moIsometricStaggered
-
moHexagonal
|
 |
TMapRenderOrder = (...); |
Values
-
mroRightDown
-
mroRightUp
-
mroLeftDown
-
mroLeftUp
|
 |
TObjectsDrawOrder = (...); |
Values
|
 |
TStaggerAxis = (...); |
Values
|
 |
TStaggerIndex = (...); |
Values
|
 |
TTerrainTypes = specialize TObjectList<TTerrain>; |
This element defines an array of terrain types, which can be referenced from the terrain attribute of the tile element.
|
 |
TTiledObjectPrimitive = (...); |
Values
-
topRectangle
-
topPoint
-
topEllipse
-
topPolygon
-
topPolyLine
|
 |
TTileList = specialize TObjectList<TTile>; |
Tiles list.
|
Methods
 |
constructor Create(const Stream: TStream; const ABaseUrl: String); overload; |
Constructor.
Parameters
- AUrl
- URL to Tiled (TMX) file.
|
 |
constructor Create(const AUrl: String); overload; |
|
 |
destructor Destroy; override; |
|
 |
function TilePositionValid(const TilePosition: TVector2Integer): Boolean; |
Is the given tile number valid. Valid map tiles are from (0, 0) (lower-left) to (Width - 1, Height - 1) (upper-right).
|
 |
function PositionToTile(const Position: TVector2; out TilePosition: TVector2Integer): Boolean; |
Detect tile under given position.
Input Position is in local map coordinates.
Output TilePosition must is a tile coordinate, where map bottom-left corner is (0, 0).
This method returns False if the position is outside of the map. Valid map tiles are defined as by TilePositionValid.
Note: Regardless of the result (True or False ), the TilePosition is reliably defined and set. It is just outside of the map range if the result is False . If you don't care about it (that is, you want to accept even positions that are outside of map range) that you're free to use TilePosition for whatever calculations.
|
 |
function TileRenderPosition(const TilePosition: TVector2Integer): TVector2; |
Left-bottom corner where the given tile should be rendered.
|
 |
function TileRenderData(const TilePosition: TVector2Integer; const Layer: TLayer; out Tileset: TTileset; out Frame: Integer; out HorizontalFlip, VerticalFlip, DiagonalFlip: Boolean): Boolean; |
Information about which image (and how) should be displayed at given map position.
|
 |
function TileNeighbor(const Tile1, Tile2: TVector2Integer; const CornersAreNeighbors: Boolean): Boolean; |
Are the two given tiles neighbors. Takes into account map Orientation, so it works for hexagonal, orthogonal etc. maps.
|
Properties
 |
property Width: Cardinal read FWidth; |
The map width in tiles.
|
 |
property Height: Cardinal read FHeight; |
The map height in tiles.
|
 |
property TileWidth: Cardinal read FTileWidth; |
The width of a tile.
|
 |
property TileHeight: Cardinal read FTileHeight; |
The height of a tile.
|
 |
property HexSideLength: Cardinal read FHexSideLength; |
The height of a hexagon side. Only relevant when Orientation = moHexagonal.
|
 |
property BackgroundColor: TCastleColor read FBackgroundColor; |
Background color of the map. It may be unset in Tiled, which results in transparent color here.
|
 |
property RenderOrder: TMapRenderOrder read FRenderOrder; |
The order in which tiles on tile layers are rendered. Valid values are right-down (the default), right-up, left-down and left-up. In all cases, the map is drawn row-by-row. (since 0.10, but only supported for orthogonal maps at the moment)
|
Generated by PasDoc 0.16.0.