Class TCastleTiledMapControl
Unit
Declaration
type TCastleTiledMapControl = class(TCastleUserInterface)
Description
Warning: this symbol is deprecated: use TCastleTiledMap in a viewport
Display a map created in Tiled (https://www.mapeditor.org/).
Hierarchy
- TObject
- TPersistent
- TComponent
- TCastleComponent
- TCastleUserInterface
- TCastleTiledMapControl
Overview
Methods
constructor Create(AOwner: TComponent); override; |
|
destructor Destroy; override; |
|
procedure Render; override; |
|
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
procedure LoadFromFile(const AUrl: String); deprecated 'set Url instead of calling LoadFromFile'; |
|
function PositionToTile(const Position: TVector2; const ContainerCoordinates: Boolean; out TilePosition: TVector2Integer): Boolean; |
|
function TileRectangle(const TilePosition: TVector2Integer; const ContainerCoordinates: Boolean): TFloatRectangle; overload; |
|
function TileRectangle(const TilePosition: TVector2Integer; const ContainerCoordinates: Boolean; const ForceTileWidth, ForceTileHeight: Single): TFloatRectangle; overload; |
Properties
property Origin: TVector2 read FOrigin write SetOrigin; |
|
property Map: TCastleTiledMapData read FMap; |
|
property ClipChildren default true; |
|
property Url: String read FUrl write SetUrl; |
|
property Scale: Single read FScale write SetScale default 1; |
|
property ObjectsVisible: Boolean read FObjectsVisible write FObjectsVisible default true; |
|
property SmoothScaling: Boolean read FSmoothScaling write SetSmoothScaling
default false; |
|
property SmoothScalingSafeBorder: Boolean read FSmoothScalingSafeBorder write SetSmoothScalingSafeBorder
default false; |
|
property OriginPersistent: TCastleVector2Persistent read FOriginPersistent ; |
Description
Methods
constructor Create(AOwner: TComponent); override; |
|
This item has no description. |
destructor Destroy; override; |
|
This item has no description. |
procedure Render; override; |
|
This item has no description. Showing description inherited from TCastleUserInterface.Render. Render a control. Called only when Exists and render context is initialized. Do not call this method. It will be automatically called by the engine when needed. It will be called when UI is part of TCastleContainer.Controls list or rendered (e.g. for off-screen rendering) by TCastleContainer.RenderControl. You should only override this method. See https://castle-engine.io/manual_2d_ui_custom_drawn.php for examples what you can put here. You can depend on some OpenGL state being set before calling this method. You can depend on it being set, and you can carelessly change it. This state we set:
Beware that GLSL RenderContext.CurrentProgram has undefined value when this is called. You should always set it, before making direct OpenGL drawing calls (all the engine drawing routines do it already, this is only a concern if you make direct OpenGL / OpenGLES calls). |
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
This item has no description. Showing description inherited from TCastleComponent.PropertySections. Section where to show property in the editor. |
function PositionToTile(const Position: TVector2; const ContainerCoordinates: Boolean; out TilePosition: TVector2Integer): Boolean; |
|
Detect tile under given position. The interpretation of Position depends on ContainerCoordinates, and is similar to e.g. TCastleViewport.PositionToCameraPlane:
Note that you can query the positions that are outside of this UI control, or even outside of the container. They will return correct map tiles, as if the map was rendered there. If you want to avoid this, you can e.g. check whether Position is inside the RenderRect (if it's a position in container coordinates, with ContainerCoordinates = This method returns |
function TileRectangle(const TilePosition: TVector2Integer; const ContainerCoordinates: Boolean): TFloatRectangle; overload; |
|
Rectangle where the given map tile is rendered. Useful to render something over a TCastleTiledMapControl, e.g. a pawn in a game. In some way, this method is an inverse of the PositionToTile method. It converts map (tile) coordinates back into coordinates useful to display something. The ContainerCoordinates value determines the coordinate system of the resulting rectangle. It's meaning is similar to the ContainerCoordinates parameter of the PositionToTile method.
This method works for any TilePosition, even outside of valid map positions. Returns TFloatRectangle.Empty is Map not loaded (Url not set). Some maps may use tilesets in which image size is different than map tile size. That is, TCastleTiledMapData.TTileset.TileWidth may be different than TCastleTiledMapData.TileWidth for some tilesets. The simpler version of this method, without ForceTileWidth/Height, just returns the size of the map tile looking at (TCastleTiledMapData.TileWidth, TCastleTiledMapData.TileHeight), since it doesn't know the tileset you use. You can pass ForceTileWidth and ForceTileHeight to set particular size. |
function TileRectangle(const TilePosition: TVector2Integer; const ContainerCoordinates: Boolean; const ForceTileWidth, ForceTileHeight: Single): TFloatRectangle; overload; |
|
This item has no description. |
Properties
property Origin: TVector2 read FOrigin write SetOrigin; |
|
Origin determines the map position at control's left-bottom corner. Increasing Origin.X moves visually the map to the left, increasing Origin.Y moves it down. |
property Map: TCastleTiledMapData read FMap; |
|
Currently loaded map (from Url), if any. |
property ClipChildren default true; |
|
This item has no description. Showing description inherited from TCastleUserInterface.ClipChildren. Clip the rendering of children. By default this is When this property is |
property Url: String read FUrl write SetUrl; |
|
Url (or just filename) of the Tiled map file (TMX). |
property Scale: Single read FScale write SetScale default 1; |
|
This item has no description. |
property ObjectsVisible: Boolean read FObjectsVisible write FObjectsVisible default true; |
|
Show objects like polylines and points on the map. |
property SmoothScaling: Boolean read FSmoothScaling write SetSmoothScaling
default false; |
|
How are images scaled (because of UI scaling, because of Scale). Beware that using |
property SmoothScalingSafeBorder: Boolean read FSmoothScalingSafeBorder write SetSmoothScalingSafeBorder
default false; |
|
In case of SmoothScaling, prevent the color outside of rendered frame from creeping in, by stretching the rendered frame a bit. See TSprite.SmoothScalingSafeBorder. It is better to prepare the sprite (tileset) images with some spacing between tiles, and color bleeding, instead of using this property. This property workarounds the fact that some sprite (tileset) images lack proper spacing and color bleeding, but it distorts the image a bit, so it's no longer pixel-perfect. |
property OriginPersistent: TCastleVector2Persistent read FOriginPersistent ; |
|
Origin that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Origin directly. See also
|
Generated by PasDoc 0.16.0-snapshot.