Class TCastleTiledMapData

Unit

Declaration

type TCastleTiledMapData = class(TObject)

Description

Loading and manipulating "Tiled" map files (http://mapeditor.org).

Hierarchy

  • TObject
  • TCastleTiledMapData

Overview

Nested Classes and Records

Public TAnimation = class(specialize TObjectList<TFrame>)
Public TData = class(TObject)
Public TFrame = class(TObject)
Public TImage = class(TObject)
Public TImageLayer = class(TLayer)
Public TLayer = class(TObject)
Public TObjectGroupLayer = class(TLayer)
Public TProperty = class(TObject)
Public TPropertyList = class(specialize TObjectList<TProperty>)
Public TTerrain = class(TObject)
Public TTile = class(TObject)
Public TTiledObject = class(TObject)
Public TTileset = class(TObject)

Nested Types

Public TCompressionType = (...);
Public TEncodingType = (...);
Public TLayerList = specialize TObjectList<TLayer>;
Public TMapOrientation = (...);
Public TMapRenderOrder = (...);
Public TObjectsDrawOrder = (...);
Public TStaggerAxis = (...);
Public TStaggerIndex = (...);
Public TTerrainTypes = specialize TObjectList<TTerrain>;
Public TTiledObjectList = specialize TObjectList<TTiledObject>;
Public TTiledObjectPrimitive = (...);
Public TTileList = specialize TObjectList<TTile>;
Public TTilesetList = specialize TObjectList<TTileset>;

Methods

Public constructor Create(const Stream: TStream; const ABaseUrl: String); overload;
Public constructor Create(const AUrl: String); overload;
Public destructor Destroy; override;
Public function TilePositionValid(const TilePosition: TVector2Integer): Boolean;
Public function PositionToTile(const Position: TVector2; out TilePosition: TVector2Integer): Boolean;
Public function TileRenderPosition(const TilePosition: TVector2Integer): TVector2;
Public function TileRenderData(const TilePosition: TVector2Integer; const Layer: TLayer; out Tileset: TTileset; out Frame: Integer; out HorizontalFlip, VerticalFlip, DiagonalFlip: Boolean): Boolean;
Public function TileNeighbor(const Tile1, Tile2: TVector2Integer; const CornersAreNeighbors: Boolean): Boolean;

Properties

Public property Layers: TLayerList read FLayers;
Public property Orientation: TMapOrientation read FOrientation;
Public property Properties: TPropertyList read FProperties;
Public property Tilesets: TTilesetList read FTilesets;
Public property Width: Cardinal read FWidth;
Public property Height: Cardinal read FHeight;
Public property TileWidth: Cardinal read FTileWidth;
Public property TileHeight: Cardinal read FTileHeight;
Public property HexSideLength: Cardinal read FHexSideLength;
Public property StaggerAxis: TStaggerAxis read FStaggerAxis;
Public property StaggerIndex: TStaggerIndex read FStaggerIndex;
Public property BackgroundColor: TCastleColor read FBackgroundColor;
Public property RenderOrder: TMapRenderOrder read FRenderOrder;

Description

Nested Types

Public TCompressionType = (...);

This item has no description.

Values
  • ctNone
  • ctGZip
  • ctZLib
Public TEncodingType = (...);

This item has no description.

Values
  • etNone
  • etBase64
  • etCSV
Public TLayerList = specialize TObjectList<TLayer>;

List of layers.

Public TMapOrientation = (...);

This item has no description.

Values
  • moOrthogonal
  • moIsometric
  • moIsometricStaggered
  • moHexagonal
Public TMapRenderOrder = (...);

This item has no description.

Values
  • mroRightDown
  • mroRightUp
  • mroLeftDown
  • mroLeftUp
Public TObjectsDrawOrder = (...);

This item has no description.

Values
  • odoIndex
  • odoTopDown
Public TStaggerAxis = (...);

This item has no description.

Values
  • saX
  • saY
Public TStaggerIndex = (...);

This item has no description.

Values
  • siOdd
  • siEven
Public TTerrainTypes = specialize TObjectList<TTerrain>;

This element defines an array of terrain types, which can be referenced from the terrain attribute of the tile element.

Public TTiledObjectList = specialize TObjectList<TTiledObject>;

This item has no description.

Public TTiledObjectPrimitive = (...);

This item has no description.

Values
  • topRectangle
  • topPoint
  • topEllipse
  • topPolygon
  • topPolyLine
Public TTileList = specialize TObjectList<TTile>;

Tiles list.

Public TTilesetList = specialize TObjectList<TTileset>;

List of tilesets.

Methods

Public constructor Create(const Stream: TStream; const ABaseUrl: String); overload;

Constructor.

Parameters
AUrl
URL to Tiled (TMX) file.
Public constructor Create(const AUrl: String); overload;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public 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).

Public 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.

Public function TileRenderPosition(const TilePosition: TVector2Integer): TVector2;

Left-bottom corner where the given tile should be rendered.

Public 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.

Public 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

Public property Layers: TLayerList read FLayers;

This item has no description.

Public property Orientation: TMapOrientation read FOrientation;

Map orientation.

Public property Properties: TPropertyList read FProperties;

This item has no description.

Public property Tilesets: TTilesetList read FTilesets;

This item has no description.

Public property Width: Cardinal read FWidth;

The map width in tiles.

Public property Height: Cardinal read FHeight;

The map height in tiles.

Public property TileWidth: Cardinal read FTileWidth;

The width of a tile.

Public property TileHeight: Cardinal read FTileHeight;

The height of a tile.

Public property HexSideLength: Cardinal read FHexSideLength;

The height of a hexagon side. Only relevant when Orientation = moHexagonal.

Public property StaggerAxis: TStaggerAxis read FStaggerAxis;

Only relevant when Orientation = moIsometricStaggered or moHexagonal.

Public property StaggerIndex: TStaggerIndex read FStaggerIndex;

Which rows are shifted by 1. Only relevant when Orientation = moIsometricStaggered or moHexagonal.

Public property BackgroundColor: TCastleColor read FBackgroundColor;

Background color of the map. It may be unset in Tiled, which results in transparent color here.

Public 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-snapshot.