-
Notifications
You must be signed in to change notification settings - Fork 0
TileSetAtlasSource
Home | API by Category | Complete API Index | API Compatibility
| Field | Value |
|---|---|
| Full name | Electron2D.TileSetAtlasSource |
| Namespace | Electron2D |
| Kind | class |
| Category | Rendering |
Provides a tile set source backed by a texture atlas.
public sealed class Electron2D.TileSetAtlasSource : Electron2D.TileSetSourceTileSetAtlasSource maps atlas coordinates to Electron2D.TileData and
texture regions. It is the only tile source implemented by the 0.1.0 Preview
runtime.
This type is not synchronized. Create and mutate atlas sources on the main scene thread or during loading.
This type is available since Electron2D 0.1.0 Preview.
Electron2D.TileDataElectron2D.TileSet
| Member | Kind | Summary |
|---|---|---|
Texture |
Property | Gets or sets the atlas texture sampled by this source. |
TextureRegionSize |
Property | Gets or sets the size of one atlas tile region in pixels. |
Electron2D.TileSetAtlasSource() |
Constructor | Initializes a new instance of the Electron2D.TileSetAtlasSource type. |
CreateTile(Electron2D.Vector2I, Electron2D.Vector2I) |
Method | Creates tile data for an atlas coordinate. |
GetTileData(Electron2D.Vector2I, System.Int32) |
Method | Gets the tile data for an atlas coordinate. |
GetTileId(System.Int32) |
Method | Gets the atlas coordinates of a tile by index. |
GetTileTextureRegion(Electron2D.Vector2I, System.Int32) |
Method | Gets the texture region used by a tile. |
GetTilesCount() |
Method | Gets the number of tiles stored by this atlas source. |
HasTile(Electron2D.Vector2I) |
Method | Checks whether tile data exists for an atlas coordinate. |
RemoveTile(Electron2D.Vector2I) |
Method | Removes tile data for an atlas coordinate. |
Kind: Property
public Electron2D.Texture2D Texture { get; set; }Gets or sets the atlas texture sampled by this source.
TileMapLayer skips cells that reference a source without a texture.
The texture containing tile regions, or null when no texture is
assigned.
This property is not synchronized. Mutate it on the main scene thread.
This property is available since Electron2D 0.1.0 Preview.
Electron2D.Texture2D
Kind: Property
public Electron2D.Vector2I TextureRegionSize { get; set; }Gets or sets the size of one atlas tile region in pixels.
A tile at atlas coordinates (x, y) uses a source rectangle whose
position is (x * width, y * height).
The positive width and height used to compute source rectangles.
-
System.ArgumentOutOfRangeException: Thrown when either component 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.TileSetAtlasSource.GetTileTextureRegion(Electron2D.Vector2I,System.Int32)
Kind: Constructor
public Electron2D.TileSetAtlasSource()Initializes a new instance of the Electron2D.TileSetAtlasSource type.
The source starts without a texture and uses a 16x16 texture
region size until configured otherwise.
This constructor is not synchronized. Call it from the thread that owns the resource being created.
This constructor is available since Electron2D 0.1.0 Preview.
Electron2D.TileSetAtlasSource.Texture
Kind: Method
public System.Void CreateTile(Electron2D.Vector2I, Electron2D.Vector2I)(Electron2D.Vector2I atlasCoords, Electron2D.Vector2I sizeInAtlas)Creates tile data for an atlas coordinate.
Recreating an existing tile keeps the existing Electron2D.TileData and
updates only its atlas-cell size.
-
atlasCoords: The atlas coordinates identifying the tile. -
sizeInAtlas: The positive tile size in atlas cells.
-
System.ArgumentOutOfRangeException: Thrown when atlas coordinates are negative or size components are not positive.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileSetAtlasSource.GetTileData(Electron2D.Vector2I,System.Int32)
Kind: Method
public Electron2D.TileData GetTileData(Electron2D.Vector2I, System.Int32)(Electron2D.Vector2I atlasCoords, System.Int32 alternativeTile)Gets the tile data for an atlas coordinate.
The 0.1.0 Preview stores only the default alternative tile, but the parameter is accepted for call-site compatibility.
-
atlasCoords: The atlas coordinates identifying the tile. -
alternativeTile: The alternative tile id.
The tile data, or null when the tile does not exist.
-
System.ArgumentOutOfRangeException: Thrown when atlas coordinates or the alternative tile id are negative.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileSetAtlasSource.CreateTile(Electron2D.Vector2I,Electron2D.Vector2I)
Kind: Method
public Electron2D.Vector2I GetTileId(System.Int32)(System.Int32 index)Gets the atlas coordinates of a tile by index.
Tiles are ordered by Y coordinate and then X coordinate for stable serialization and tests.
-
index: The zero-based index in sorted tile order.
The atlas coordinates of the tile.
-
System.ArgumentOutOfRangeException: Thrown whenindexis outside the stored tile range.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileSetAtlasSource.GetTilesCount
Kind: Method
public Electron2D.Rect2 GetTileTextureRegion(Electron2D.Vector2I, System.Int32)(Electron2D.Vector2I atlasCoords, System.Int32 alternativeTile)Gets the texture region used by a tile.
The returned region is based on Electron2D.TileSetAtlasSource.TextureRegionSize and the
tile's size in atlas cells.
-
atlasCoords: The atlas coordinates identifying the tile. -
alternativeTile: The alternative tile id.
The source rectangle in atlas texture pixels.
-
System.ArgumentOutOfRangeException: Thrown when atlas coordinates or the alternative tile id are negative. -
System.InvalidOperationException: Thrown when the tile does not exist.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileSetAtlasSource.TextureRegionSize
Kind: Method
public System.Int32 GetTilesCount()()Gets the number of tiles stored by this atlas source.
The count includes tiles even when Electron2D.TileSetAtlasSource.Texture is not assigned.
The number of default alternative tiles.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileSetAtlasSource.GetTileId(System.Int32)
Kind: Method
public System.Boolean HasTile(Electron2D.Vector2I)(Electron2D.Vector2I atlasCoords)Checks whether tile data exists for an atlas coordinate.
This method checks the default alternative tile entry.
-
atlasCoords: The atlas coordinates identifying the tile.
true when the tile exists; otherwise, false.
-
System.ArgumentOutOfRangeException: Thrown when atlas coordinates are negative.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileSetAtlasSource.CreateTile(Electron2D.Vector2I,Electron2D.Vector2I)
Kind: Method
public System.Void RemoveTile(Electron2D.Vector2I)(Electron2D.Vector2I atlasCoords)Removes tile data for an atlas coordinate.
Removing a missing tile does nothing.
-
atlasCoords: The atlas coordinates identifying the tile.
-
System.ArgumentOutOfRangeException: Thrown when atlas coordinates are negative.
This method is not synchronized. Call it on the main scene thread.
This method is available since Electron2D 0.1.0 Preview.
Electron2D.TileSetAtlasSource.HasTile(Electron2D.Vector2I)
Electron2D 0.1.0 Preview API reference. Generated from 175 public runtime types.