-
Notifications
You must be signed in to change notification settings - Fork 0
TileMapLayer
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.TileMapLayer |
| Namespace | Electron2D |
| Kind | class |
| Category | Rendering |
Provides a single 2D tilemap layer.
public class Electron2D.TileMapLayer : Electron2D.Node2DProfile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: TileMapLayer
Runtime tile map layer with cell storage, coordinate conversion, canvas submission, body RID queries and one-way tile collision shapes.
TileMapLayer stores cell identifiers, submits visible atlas tiles to the
canvas render queue and exposes tile collision polygons to the managed 2D
physics query path.
This type is not synchronized. Create and mutate tilemap layers on the main scene thread.
This type is available since Electron2D 0.1.0 Preview.
Electron2D.TileDataElectron2D.TileMapLayer.TileSet
| Member | Kind | Summary |
|---|---|---|
CollisionEnabled |
Property | Gets or sets whether tile collision polygons participate in physics. |
Enabled |
Property | Gets or sets whether this layer is active. |
PhysicsQuadrantSize |
Property | Gets or sets the physics quadrant size. |
RenderingQuadrantSize |
Property | Gets or sets the rendering quadrant size. |
TileSet |
Property | Gets or sets the tile set used by this layer. |
XDrawOrderReversed |
Property | Gets or sets whether tile draw order is reversed on the X axis. |
YSortOrigin |
Property | Gets or sets the Y-sort origin offset for submitted tiles. |
Electron2D.TileMapLayer() |
Constructor | Initializes a new instance of the Electron2D.TileMapLayer type. |
Clear() |
Method | Removes all cells from this layer. |
EraseCell(Electron2D.Vector2I) |
Method | Erases a tile cell at map coordinates. |
GetCellAlternativeTile(Electron2D.Vector2I) |
Method | Gets the alternative tile id stored in a cell. |
GetCellAtlasCoords(Electron2D.Vector2I) |
Method | Gets the atlas coordinates stored in a cell. |
GetCellSourceId(Electron2D.Vector2I) |
Method | Gets the source id stored in a cell. |
GetCellTileData(Electron2D.Vector2I) |
Method | Gets the tile data referenced by a cell. |
GetCoordsForBodyRid(Electron2D.Rid) |
Method | Gets cell coordinates for a body RID when they are unambiguous. |
GetUsedCells() |
Method | Gets all used cell coordinates. |
GetUsedCellsById(System.Int32, Electron2D.Vector2I?, System.Int32) |
Method | Gets used cell coordinates filtered by stored tile identifiers. |
GetUsedRect() |
Method | Gets the rectangle enclosing all used cells. |
HasBodyRid(Electron2D.Rid) |
Method | Checks whether a body RID belongs to this tilemap layer. |
LocalToMap(Electron2D.Vector2) |
Method | Converts a local position to map coordinates. |
MapToLocal(Electron2D.Vector2I) |
Method | Converts map coordinates to a local cell-center position. |
NotifyRuntimeTileDataUpdate() |
Method | Notifies the layer that runtime tile data has changed. |
SetCell(Electron2D.Vector2I, System.Int32, Electron2D.Vector2I, System.Int32) |
Method | Stores a tile cell at map coordinates. |
UpdateInternals() |
Method | Applies pending tilemap updates immediately. |
Kind: Property
public System.Boolean CollisionEnabled { get; set; }Gets or sets whether tile collision polygons participate in physics.
Rendering is controlled separately by Electron2D.TileMapLayer.Enabled and
Electron2D.CanvasItem.Visible.
true when tile collision polygons should be active; otherwise,
false.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.Enabled
Kind: Property
public System.Boolean Enabled { get; set; }Gets or sets whether this layer is active.
Disabling the layer leaves stored cells unchanged.
true when rendering and collision are enabled for the layer;
otherwise, false.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.CollisionEnabled
Kind: Property
public System.Int32 PhysicsQuadrantSize { get; set; }Gets or sets the physics quadrant size.
The preview stores this value for API state. Physics shapes are not chunk-merged yet.
The positive quadrant side length in map cells.
-
System.ArgumentOutOfRangeException: Thrown when the value is less than or equal to zero.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.RenderingQuadrantSize
Kind: Property
public System.Int32 RenderingQuadrantSize { get; set; }Gets or sets the rendering quadrant size.
The preview stores this value for API state. Rendering commands are not chunk-merged yet.
The positive quadrant side length in map cells.
-
System.ArgumentOutOfRangeException: Thrown when the value is less than or equal to zero.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.PhysicsQuadrantSize
Kind: Property
public Electron2D.TileSet TileSet { get; set; }Gets or sets the tile set used by this layer.
Cells remain stored when this property changes. Rendering and collision use the currently assigned tile set.
The tile set resource, or null when this layer has no tile
definitions.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.TileSet
Kind: Property
public System.Boolean XDrawOrderReversed { get; set; }Gets or sets whether tile draw order is reversed on the X axis.
The flag affects stable submission order when cells have the same z-index.
true to submit cells with higher X coordinates first inside each
row; otherwise, false.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.GetUsedCells
Kind: Property
public System.Int32 YSortOrigin { get; set; }Gets or sets the Y-sort origin offset for submitted tiles.
The value is added to each cell's local Y position before it enters the canvas render queue.
The local Y offset used to derive tile y-sort positions.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.CanvasItem.YSortEnabled
Kind: Constructor
public Electron2D.TileMapLayer()Initializes a new instance of the Electron2D.TileMapLayer type.
The layer starts enabled, collision-enabled and empty.
This constructor is not synchronized. Call it from the thread that owns the node being created.
This constructor is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.TileSet
Kind: Method
public System.Void Clear()()Removes all cells from this layer.
This method does not change Electron2D.TileMapLayer.TileSet or layer settings.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.EraseCell(Electron2D.Vector2I)
Kind: Method
public System.Void EraseCell(Electron2D.Vector2I)(Electron2D.Vector2I coords)Erases a tile cell at map coordinates.
Erasing a missing cell does nothing.
-
coords: The map coordinates of the cell to erase.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.SetCell(Electron2D.Vector2I,System.Int32,Electron2D.Vector2I,System.Int32)
Kind: Method
public System.Int32 GetCellAlternativeTile(Electron2D.Vector2I)(Electron2D.Vector2I coords)Gets the alternative tile id stored in a cell.
The 0.1.0 Preview stores the value but only default atlas alternative
data is implemented by Electron2D.TileSetAtlasSource.
-
coords: The map coordinates of the cell.
The alternative tile id, or -1 when the cell is empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.SetCell(Electron2D.Vector2I,System.Int32,Electron2D.Vector2I,System.Int32)
Kind: Method
public Electron2D.Vector2I GetCellAtlasCoords(Electron2D.Vector2I)(Electron2D.Vector2I coords)Gets the atlas coordinates stored in a cell.
The method reads stored cell data only; it does not validate whether the source contains the atlas tile.
-
coords: The map coordinates of the cell.
The atlas coordinates, or Vector2I(-1, -1) when the cell is empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.GetCellSourceId(Electron2D.Vector2I)
Kind: Method
public System.Int32 GetCellSourceId(Electron2D.Vector2I)(Electron2D.Vector2I coords)Gets the source id stored in a cell.
The method reads stored cell data only; it does not validate whether the
current Electron2D.TileMapLayer.TileSet still contains the source.
-
coords: The map coordinates of the cell.
The source id, or -1 when the cell is empty.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.SetCell(Electron2D.Vector2I,System.Int32,Electron2D.Vector2I,System.Int32)
Kind: Method
public Electron2D.TileData GetCellTileData(Electron2D.Vector2I)(Electron2D.Vector2I coords)Gets the tile data referenced by a cell.
The method returns null for empty cells, missing tile sets, missing
sources and non-atlas sources.
-
coords: The map coordinates of the cell.
The tile data, or null when no tile data is available.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileData
Kind: Method
public Electron2D.Vector2I GetCoordsForBodyRid(Electron2D.Rid)(Electron2D.Rid body)Gets cell coordinates for a body RID when they are unambiguous.
The preview stores one internal body RID for the whole layer. The method returns cell coordinates only when exactly one cell is used.
-
body: The body RID to query.
The single used cell coordinates, or Vector2I(-1, -1) when unavailable.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.HasBodyRid(Electron2D.Rid)
Kind: Method
public Electron2D.Vector2I[] GetUsedCells()()Gets all used cell coordinates.
Coordinates are ordered by Y coordinate and then X coordinate.
A new array containing used cell coordinates in stable order.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.GetUsedCellsById(System.Int32,System.Nullable{Electron2D.Vector2I},System.Int32)
Kind: Method
public Electron2D.Vector2I[] GetUsedCellsById(System.Int32, Electron2D.Vector2I?, System.Int32)(System.Int32 sourceId, Electron2D.Vector2I? atlasCoords, System.Int32 alternativeTile)Gets used cell coordinates filtered by stored tile identifiers.
Filtering uses stored cell identifiers and does not require the tile set source to exist.
-
sourceId: The source id to match, or-1to ignore source id. -
atlasCoords: The atlas coordinates to match, ornullto ignore atlas coordinates. -
alternativeTile: The alternative tile id to match, or-1to ignore alternative tile id.
A new array containing matching used cell coordinates.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.GetUsedCells
Kind: Method
public Electron2D.Rect2I GetUsedRect()()Gets the rectangle enclosing all used cells.
The rectangle is expressed in map coordinates.
The used cell rectangle, or an empty rectangle when no cells are used.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.GetUsedCells
Kind: Method
public System.Boolean HasBodyRid(Electron2D.Rid)(Electron2D.Rid body)Checks whether a body RID belongs to this tilemap layer.
The RID is created only while the layer is inside a Electron2D.SceneTree.
-
body: The body RID to check.
true when the RID is this layer's internal body RID.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.GetCoordsForBodyRid(Electron2D.Rid)
Kind: Method
public Electron2D.Vector2I LocalToMap(Electron2D.Vector2)(Electron2D.Vector2 localPosition)Converts a local position to map coordinates.
The conversion uses floor division, so negative positions map to negative cells.
-
localPosition: The local position in this layer.
The map coordinates containing the position.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.MapToLocal(Electron2D.Vector2I)
Kind: Method
public Electron2D.Vector2 MapToLocal(Electron2D.Vector2I)(Electron2D.Vector2I mapPosition)Converts map coordinates to a local cell-center position.
Rendering destination rectangles still start at the cell's top-left local position.
-
mapPosition: The map coordinates to convert.
The local position at the center of the cell.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.LocalToMap(Electron2D.Vector2)
Kind: Method
public System.Void NotifyRuntimeTileDataUpdate()()Notifies the layer that runtime tile data has changed.
The preview does not defer tile data caches, so this method queues a redraw and returns.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.UpdateInternals
Kind: Method
public System.Void SetCell(Electron2D.Vector2I, System.Int32, Electron2D.Vector2I, System.Int32)(Electron2D.Vector2I coords, System.Int32 sourceId, Electron2D.Vector2I atlasCoords, System.Int32 alternativeTile)Stores a tile cell at map coordinates.
Passing a negative source id or negative atlas coordinates erases the cell.
-
coords: The map coordinates of the cell. -
sourceId: The tile set source id, or-1to erase the cell. -
atlasCoords: The atlas coordinates inside the source. -
alternativeTile: The alternative tile id.
-
System.ArgumentOutOfRangeException: Thrown whenalternativeTileis negative for a stored cell.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.EraseCell(Electron2D.Vector2I)
Kind: Method
public System.Void UpdateInternals()()Applies pending tilemap updates immediately.
The preview updates cell data immediately, so this method queues a redraw and returns.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileMapLayer.NotifyRuntimeTileDataUpdate
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.