Otter  0.9.88
2d Game Development Framework based on SFML.Net
 All Classes Namespaces Functions Variables Enumerations Properties
Otter.Tilemap Class Reference

Graphic used for loading and rendering a tilemap. Renders tiles using a vertex array. More...

Inherits Otter.Graphic.

Public Member Functions

 Tilemap (string source, int width, int height, int tileWidth, int tileHeight)
 Create a new Tilemap using the path of a texture. More...
 
 Tilemap (string source, int size, int tileSize)
 Create a new Tilemap using the path of a texture. More...
 
 Tilemap (Texture texture, int width, int height, int tileWidth, int tileHeight)
 Create a new Tilemap using a Texture. More...
 
 Tilemap (Texture texture, int size, int tileSize)
 Create a new Tilemap using a Texture. More...
 
 Tilemap (AtlasTexture texture, int width, int height, int tileWidth, int tileHeight)
 Create a new Tilemap using an AtlasTexture. More...
 
 Tilemap (AtlasTexture texture, int size, int tileSize)
 Create a new Tilemap using an AtlasTexture. More...
 
 Tilemap (int width, int height, int tileWidth, int tileHeight)
 Create a new Tilemap without any texture. Tiles will be solid colors instead. More...
 
 Tilemap (int size, int tileSize)
 Create a new Tilemap without any texture. Tiles will be solid colors instead. More...
 
TileInfo SetTile (int tileX, int tileY, Color color, string layer="")
 Set a tile to a specific color. More...
 
TileInfo SetTile (int tileX, int tileY, Color color, Enum layer)
 Set a tile to a specific color. More...
 
TileInfo SetTile (int tileX, int tileY, int sourceX, int sourceY, string layer="")
 Set a tile to a specific tile from the source texture. More...
 
TileInfo SetTile (int tileX, int tileY, int sourceX, int sourceY, Enum layer)
 Set a tile to a specific tile from the source texture. More...
 
TileInfo SetTile (XmlElement e)
 Load tile data from an XmlElement. More...
 
TileInfo SetTile (int tileX, int tileY, int tileIndex, string layer="")
 Set a tile on the Tilemap to a specific tile. More...
 
TileInfo SetTile (int tileX, int tileY, int tileIndex, Enum layer)
 Set a tile on the Tilemap to a specific tile. More...
 
TileInfo SetTile (int tileX, int tileY, bool flipX, bool flipY)
 Set a tile on the Tilemap to be flipped horizontally and/or vertically. More...
 
void SetRect (int tileX, int tileY, int tileWidth, int tileHeight, Color color, string layer="")
 Set a rectangle area of tiles to a defined color. More...
 
void SetRect (int tileX, int tileY, int tileWidth, int tileHeight, Color color, Enum layer)
 Set a rectangle area of tiles to a defined color. More...
 
void SetRect (int tileX, int tileY, int tileWidth, int tileHeight, int sourceX, int sourceY, string layer="")
 Set a rectangle of tiles to a tile defined by texture coordinates. More...
 
void SetRect (int tileX, int tileY, int tileWidth, int tileHeight, int sourceX, int sourceY, Enum layer)
 Set a rectangle of tiles to a tile defined by texture coordinates. More...
 
void SetRect (int tileX, int tileY, int tileWidth, int tileHeight, int tileIndex, string layer="")
 Set a rectangle of tiles to a tile defined by an index. More...
 
void SetRect (int tileX, int tileY, int tileWidth, int tileHeight, int tileIndex, Enum layer)
 Set a rectangle of tiles to a tile defined by an index. More...
 
void SetLayer (int tileIndex, string layer="")
 Set all tiles of a specific layer. More...
 
void SetLayer (int sourceX, int sourceY, string layer="")
 Set all tiles of a specific layer. More...
 
void SetLayer (Color color, string layer="")
 Set all tiles of a specific layer. More...
 
void SetLayer (int tileIndex, Enum layer)
 Set all tiles of a specific layer. More...
 
void SetLayer (int sourceX, int sourceY, Enum layer)
 Set all tiles of a specific layer. More...
 
void SetLayer (Color color, Enum layer)
 Set all tiles of a specific layer. More...
 
TileInfo GetTile (int tileX, int tileY, string layer="")
 Get the TileInfo of a specific tile on the tilemap. More...
 
TileInfo GetTile (int tileX, int tileY, Enum layer)
 Get the TileInfo of a specific tile on the tilemap. More...
 
void LoadGrid (GridCollider grid, Color color, string layer="")
 Load tiles in from a GridCollider. More...
 
void SetAutoTileData (string tileData)
 Assign the tile data to use for LoadGridAutoTile. More...
 
void LoadGridAutoTile (GridCollider grid, string layer="")
 Load tiles in from a GridCollider and choose tiles based on the shape of the grid. More...
 
void LoadGrid (GridCollider grid, Color color, Enum layer)
 Load tiles in from a GridCollider. More...
 
string LayerName (int layer)
 Get the layer name for a specific layer on the tilemap. More...
 
int LayerDepth (string layer)
 Get the layer depth of a layer on the tilemap by name. More...
 
int LayerDepth (Enum layer)
 Get the layer depth of a layer on the tilemap by enum value. More...
 
void LoadString (string source, Color color=null, char empty= '0', char filled= '1', string layer="")
 Load the tilemap with a color based on a string. More...
 
void LoadString (string source, Color color, char empty, char filled, Enum layer)
 Load the tilemap with a color based on a string. More...
 
void LoadCSV (string str, char columnSep= ',', char rowSep= '\n', string layer="")
 Load the tilemap from a CSV formatted string. More...
 
void LoadCSV (string str, char columnSep, char rowSep, Enum layer)
 Load the tilemap from a CSV formatted string. More...
 
TileInfo ClearTile (int tileX, int tileY, string layer="")
 Remove a tile from the tilemap. More...
 
TileInfo ClearTile (int tileX, int tileY, Enum layer)
 Remove a tile from the tilemap. More...
 
void ClearLayer (string layer="")
 Clear all tiles on a specific layer. More...
 
void ClearLayer (Enum layer)
 Clear all tiles on a specific layer. More...
 
void ClearAll ()
 Clear all tiles on all layers. More...
 
void ClearRect (int tileX, int tileY, int tileWidth, int tileHeight, string layer="")
 Clear all tiles inside a specified rectangle. More...
 
int AddLayer (string name, int depth=0)
 Add a new layer to the Tilemap. More...
 
int AddLayer (Enum name, int depth=0)
 Add a new layer to the Tilemap. More...
 
bool LayerExists (string name)
 Check if a layer exists. More...
 
bool LayerExists (Enum name)
 Check if a layer exists. More...
 
void MergeTilemap (Tilemap other, string layerPrefix="", int layerOffset=-1)
 Merges another tilemap into this one. More...
 
List< TileInfoGetTiles (string layerName)
 Get the list of tiles on a specific layer. More...
 
List< TileInfoGetTiles (int layerDepth)
 Get the list of tiles on a specific layer. More...
 
List< TileInfoGetTiles (Enum layerName)
 Get the list of tiles on a specific layer. More...
 
int GetTileIndex (TileInfo tile)
 Get the index of a specific tile on the source Texture. More...
 
- Public Member Functions inherited from Otter.Graphic
Transformation AddTransform (Transformation transform)
 
Transformation AddTransform (Vector2 translation, Vector2 scale, Vector2 origin, float rotation)
 
Transformation AddTransform ()
 
Transformation RemoveTransformation (Transformation transform)
 
Transformation PopTransformation ()
 
virtual void ClearShader ()
 Removes the shader from the graphic. More...
 
void SetPosition (float x, float y)
 Set the position of the Graphic. More...
 
void SetPosition (Graphic g, float offsetX=0, float offsetY=0)
 Set the position of the Graphic. More...
 
void SetPosition (Vector2 xy)
 Set the position of the Graphic. More...
 
void SetOrigin (float x, float y)
 Set the origin of the Graphic. More...
 
void SetOrigin (Vector2 xy)
 Set the origin of the Graphic. More...
 
void SetTexture (string path)
 Set the Texture that the Graphic is using (if it is using one.) More...
 
void SetTexture (Texture texture)
 Set the Texture that the Graphic is using (if it is using one.) More...
 
void SetTexture (AtlasTexture atlasTexture)
 Set the Texture that the Graphic is using (if it is using one.) More...
 
virtual void Update ()
 Update the graphic. More...
 
virtual void CenterOrigin ()
 Centers the graphic origin. More...
 
virtual void CenterOriginZero ()
 Centers the graphic origin while retaining its relative position. More...
 
virtual void Render (float x=0, float y=0)
 Draws the graphic. More...
 

Public Attributes

bool UsePositions
 Determines if the X and Y positions of tiles are interpreted as pixels or tile coords. More...
 
string DefaultLayerName = "base"
 The default layer name to use. More...
 
- Public Attributes inherited from Otter.Graphic
List< TransformationTransforms = new List<Transformation>() { new Transformation() }
 
bool Relative = true
 Determines if the Graphic is rendered relative to its Entity. More...
 
bool Visible = true
 Determines if the Graphic will render. More...
 
float ScrollX = 1
 The scroll factor for the x position. Used for parallax like effects. Values lower than 1 will scroll slower than the camera (appear to be further away) and values higher than 1 will scroll faster than the camera (appear to be closer.) More...
 
float ScrollY = 1
 The scroll factor for the y position. Used for parallax like effects. Values lower than 1 will scroll slower than the camera (appear to be further away) and values higher than 1 will scroll faster than the camera (appear to be closer.) More...
 
float ShakeX
 The horizontal amount to randomly offset the graphic by each frame. More...
 
float ShakeY
 The vertial amount to randomly offset the graphic by each frame. More...
 
Rectangle TextureRegion
 The region to render the Texture with. More...
 
Rectangle AtlasRegion
 The Rectangle to render an AtlasTexture with. More...
 
Shader Shader
 The shader to be applied to this graphic. More...
 
string Name = "Graphic"
 The name of the graphic. More...
 
BlendMode Blend = BlendMode.Alpha
 The blend mode to be applied to this graphic. More...
 
bool RepeatX
 Determines if the image should be rendered multiple times horizontally. More...
 
bool RepeatY
 Determines if the image should be rendered multiple times vertically. More...
 

Protected Member Functions

override void UpdateDrawable ()
 Updates the internal SFML data for rendering. More...
 
- Protected Member Functions inherited from Otter.Graphic
void Append (float x, float y, Color color, float u, float v)
 
void Append (float x, float y, Color color=null)
 
virtual void SFMLRender (Drawable drawable, float x=0, float y=0)
 

Properties

int TileWidth [get, set]
 The width in pixels of each tile. More...
 
int TileHeight [get, set]
 The height in pixels of each tile. More...
 
int TileRows [get, set]
 The number of rows in the entire tilemap. More...
 
int TileColumns [get, set]
 The number of columsn in the entire tilemap. More...
 
SortedDictionary< int, List
< TileInfo > > 
TileLayers [get, set]
 The tile layers to render. More...
 
- Properties inherited from Otter.Graphic
Transformation Transform [get]
 
float X [get, set]
 The X position of the Graphic. More...
 
float Y [get, set]
 The Y position of the Graphic. More...
 
float ScaleX [get, set]
 The horizontal scale of the graphic. Used in the final transformation. More...
 
float ScaleY [get, set]
 The vertical scale of the graphic. Used in the final transformation. More...
 
float Angle [get, set]
 The angle of rotation of the graphic. Used in the final transformation. More...
 
float OriginX [get, set]
 The X origin point to scale and rotate the graphic with. Used in the final transformation. More...
 
float OriginY [get, set]
 The Y origin point to scale and rotate the graphic with. Used in the final transformation. More...
 
Color Color [get, set]
 The base color of the Graphic. Multiplies the vertices of the graphic by this color. More...
 
virtual Texture Texture [get, set]
 The texture that the graphic is using. More...
 
float Alpha [get, set]
 The base transparency of the graphic. A shortcut to access the base color's Alpha. More...
 
int Width [get, set]
 The width of the Graphic. More...
 
int Height [get, set]
 The height of the Graphic. More...
 
float ScaledWidth [get, set]
 The width in pixels of the image after applying the X scale. More...
 
float ScaledHeight [get, set]
 The height in pixels of the image after applying the Y scale. More...
 
virtual bool Smooth [get, set]
 Smooth the texture of a sprite image while scaling it. More...
 
float Scroll [get, set]
 Set both ScrollX and ScrollY. More...
 
float HalfWidth [get]
 Half of the width. More...
 
float HalfHeight [get]
 Half of the height. More...
 
float Scale [set]
 Sets both the ScaleX and ScaleY at the same time. More...
 
bool Repeat [set]
 Sets both RepeatX and RepeatY at the same time. More...
 
float Shake [set]
 A shortcut to set both ShakeX and ShakeY. More...
 
float Left [get]
 The X position of the left side of the Graphic. More...
 
float Top [get]
 The Y position of the top of the Graphic. More...
 
float Right [get]
 The X position of the right side of the Graphic. More...
 
float Bottom [get]
 The Y position of the bottom of the Graphic. More...
 
int TextureLeft [get]
 The X position of the left of the Texture. More...
 
int TextureRight [get]
 The X position of the right of the Texture. More...
 
int TextureTop [get]
 The Y position of the top of the Texture. More...
 
int TextureBottom [get]
 The Y position of the bottom of the Texture. More...
 

Additional Inherited Members

- Protected Attributes inherited from Otter.Graphic
VertexArray SFMLVertices = new VertexArray(PrimitiveType.Quads)
 
Drawable SFMLDrawable
 
float RepeatSizeX
 
bool roundRendering = true
 
bool Dynamic
 If true the graphic will always update its drawable. More...
 

Detailed Description

Graphic used for loading and rendering a tilemap. Renders tiles using a vertex array.

Constructor & Destructor Documentation

Otter.Tilemap.Tilemap ( string  source,
int  width,
int  height,
int  tileWidth,
int  tileHeight 
)

Create a new Tilemap using the path of a texture.

Parameters
sourceThe file path to the texture to use.
widthThe width of the Tilemap in pixels.
heightThe height of the Tilemap in pixels.
tileWidthThe width of each tile in pixels.
tileHeightThe height of each tile in pixels.
Otter.Tilemap.Tilemap ( string  source,
int  size,
int  tileSize 
)

Create a new Tilemap using the path of a texture.

Parameters
sourceThe file path to the texture to use.
sizeThe width and height of the Tilemap in pixels.
tileSizeThe width and height of each tile in pixels.
Otter.Tilemap.Tilemap ( Texture  texture,
int  width,
int  height,
int  tileWidth,
int  tileHeight 
)

Create a new Tilemap using a Texture.

Parameters
textureThe Texture to use.
widthThe width of the Tilemap in pixels.
heightThe height of the Tilemap in pixels.
tileWidthThe width of each tile in pixels.
tileHeightThe height of each tile in pixels.
Otter.Tilemap.Tilemap ( Texture  texture,
int  size,
int  tileSize 
)

Create a new Tilemap using a Texture.

Parameters
textureThe Texture to use.
sizeThe width and height of the Tilemap in pixels.
tileSizeThe width and height of each tile in pixels.
Otter.Tilemap.Tilemap ( AtlasTexture  texture,
int  width,
int  height,
int  tileWidth,
int  tileHeight 
)

Create a new Tilemap using an AtlasTexture.

Parameters
textureThe AtlasTexture to use.
widthThe width of the Tilemap in pixels.
heightThe height of the Tilemap in pixels.
tileWidthThe width of each tile in pixels.
tileHeightThe height of each tile in pixels.
Otter.Tilemap.Tilemap ( AtlasTexture  texture,
int  size,
int  tileSize 
)

Create a new Tilemap using an AtlasTexture.

Parameters
textureThe AtlasTexture to use.
sizeThe width and height of the Tilemap in pixels.
tileSizeThe width and height of each tile in pixels.
Otter.Tilemap.Tilemap ( int  width,
int  height,
int  tileWidth,
int  tileHeight 
)

Create a new Tilemap without any texture. Tiles will be solid colors instead.

Parameters
widthThe width of the Tilemap in pixels.
heightThe height of the Tilemap in pixels.
tileWidthThe width of each tile in pixels.
tileHeightThe height of each tile in pixels.
Otter.Tilemap.Tilemap ( int  size,
int  tileSize 
)

Create a new Tilemap without any texture. Tiles will be solid colors instead.

Parameters
sizeThe width and height of the Tilemap in pixels.
tileSizeThe width and height of each tile in pixels.

Member Function Documentation

int Otter.Tilemap.AddLayer ( string  name,
int  depth = 0 
)

Add a new layer to the Tilemap.

Parameters
nameThe string name of the layer.
depthThe depth of the tiles.
Returns
The depth id of the layer.
int Otter.Tilemap.AddLayer ( Enum  name,
int  depth = 0 
)

Add a new layer to the Tilemap.

Parameters
nameThe enum value of the layer.
depthThe depth of the tiles.
Returns
The depth id of the layer.
void Otter.Tilemap.ClearAll ( )

Clear all tiles on all layers.

void Otter.Tilemap.ClearLayer ( string  layer = "")

Clear all tiles on a specific layer.

Parameters
layerThe string layer name.
void Otter.Tilemap.ClearLayer ( Enum  layer)

Clear all tiles on a specific layer.

Parameters
layerThe enum value layer.
void Otter.Tilemap.ClearRect ( int  tileX,
int  tileY,
int  tileWidth,
int  tileHeight,
string  layer = "" 
)

Clear all tiles inside a specified rectangle.

Parameters
tileXThe X position of the rectangle to clear.
tileYThe Y position of the rectangle to clear.
tileWidthThe width of tiles to clear.
tileHeightThe height of tiles to clear.
layerThe layer to clear tiles from.
TileInfo Otter.Tilemap.ClearTile ( int  tileX,
int  tileY,
string  layer = "" 
)

Remove a tile from the tilemap.

Parameters
tileXThe tile's X position on the map.
tileYThe tile's Y position on the map.
layerThe tile's layer.
Returns
The TileInfo for the cleared tile.
TileInfo Otter.Tilemap.ClearTile ( int  tileX,
int  tileY,
Enum  layer 
)

Remove a tile from the tilemap.

Parameters
tileXThe tile's X position on the map.
tileYThe tile's Y position on the map.
layerThe tile's layer.
Returns
The TileInfo for the cleared tile.
TileInfo Otter.Tilemap.GetTile ( int  tileX,
int  tileY,
string  layer = "" 
)

Get the TileInfo of a specific tile on the tilemap.

Parameters
tileXThe X position of the tile to retrieve.
tileYThe Y position of the tile to retrieve.
layerThe layer to search through for the tile.
Returns
The TileInfo for the found tile.
TileInfo Otter.Tilemap.GetTile ( int  tileX,
int  tileY,
Enum  layer 
)

Get the TileInfo of a specific tile on the tilemap.

Parameters
tileXThe X position of the tile to retrieve.
tileYThe Y position of the tile to retrieve.
layerThe layer to search through for the tile.
Returns
The TileInfo for the found tile.
int Otter.Tilemap.GetTileIndex ( TileInfo  tile)

Get the index of a specific tile on the source Texture.

Parameters
tileThe tile to get the index of.
Returns
The index of the tile.
List<TileInfo> Otter.Tilemap.GetTiles ( string  layerName)

Get the list of tiles on a specific layer.

Parameters
layerNameThe name of the layer.
Returns
A list of tiles on that layer.
List<TileInfo> Otter.Tilemap.GetTiles ( int  layerDepth)

Get the list of tiles on a specific layer.

Parameters
layerDepth
Returns
A list of tiles on that layer.
List<TileInfo> Otter.Tilemap.GetTiles ( Enum  layerName)

Get the list of tiles on a specific layer.

Parameters
layerNameThe enum value of the layer.
Returns
A list of tiles on that layer.
int Otter.Tilemap.LayerDepth ( string  layer)

Get the layer depth of a layer on the tilemap by name.

Parameters
layerThe string layer name.
Returns
The layer depth id.
int Otter.Tilemap.LayerDepth ( Enum  layer)

Get the layer depth of a layer on the tilemap by enum value.

Parameters
layerThe enum value layer.
Returns
The layer depth id.
bool Otter.Tilemap.LayerExists ( string  name)

Check if a layer exists.

Parameters
nameThe string name of the layer.
Returns
True if the layer exists.
bool Otter.Tilemap.LayerExists ( Enum  name)

Check if a layer exists.

Parameters
nameThe enum value of the layer.
Returns
True if the layer exists.
string Otter.Tilemap.LayerName ( int  layer)

Get the layer name for a specific layer on the tilemap.

Parameters
layerThe layer depth id.
Returns
The string name of the layer.
void Otter.Tilemap.LoadCSV ( string  str,
char  columnSep = ',',
char  rowSep = '\n',
string  layer = "" 
)

Load the tilemap from a CSV formatted string.

Parameters
strThe string data to load.
columnSepThe character that separates columns in the CSV.
rowSepThe character that separates rows in the CSV.
layerThe layer to place the tiles on.
void Otter.Tilemap.LoadCSV ( string  str,
char  columnSep,
char  rowSep,
Enum  layer 
)

Load the tilemap from a CSV formatted string.

Parameters
strThe string data to load.
columnSepThe character that separates columns in the CSV.
rowSepThe character that separates rows in the CSV.
layerThe layer to place the tiles on.
void Otter.Tilemap.LoadGrid ( GridCollider  grid,
Color  color,
string  layer = "" 
)

Load tiles in from a GridCollider.

Parameters
gridThe GridCollider to reference.
colorThe color to set tiles that are collidable on the grid.
layerThe layer to place the tiles on.
void Otter.Tilemap.LoadGrid ( GridCollider  grid,
Color  color,
Enum  layer 
)

Load tiles in from a GridCollider.

Parameters
gridThe GridCollider to reference.
colorThe color to set tiles that are collidable on the grid.
layerThe layer to place the tiles on.
void Otter.Tilemap.LoadGridAutoTile ( GridCollider  grid,
string  layer = "" 
)

Load tiles in from a GridCollider and choose tiles based on the shape of the grid.

Parameters
gridThe GridCollider to reference.
layerThe layer to place the tiles on.
void Otter.Tilemap.LoadString ( string  source,
Color  color = null,
char  empty = '0',
char  filled = '1',
string  layer = "" 
)

Load the tilemap with a color based on a string.

Parameters
sourceThe string data to load.
colorThe color to fill occupied tiles with.
emptyThe character that represents an empty tile.
filledThe character that represents a filled tile.
layerThe layer to place the tiles on.
void Otter.Tilemap.LoadString ( string  source,
Color  color,
char  empty,
char  filled,
Enum  layer 
)

Load the tilemap with a color based on a string.

Parameters
sourceThe string data to load.
colorThe color to fill occupied tiles with.
emptyThe character that represents an empty tile.
filledThe character that represents a filled tile.
layerThe layer to place the tiles on.
void Otter.Tilemap.MergeTilemap ( Tilemap  other,
string  layerPrefix = "",
int  layerOffset = -1 
)

Merges another tilemap into this one.

Parameters
otherThe tilemap to merge into this one.
aboveTrue if the other tilemap's base layer should be above this one's base layer.
void Otter.Tilemap.SetAutoTileData ( string  tileData)

Assign the tile data to use for LoadGridAutoTile.

Parameters
tileDataThe tile data file.
void Otter.Tilemap.SetLayer ( int  tileIndex,
string  layer = "" 
)

Set all tiles of a specific layer.

Parameters
tileIndexThe index of the tile to change the tiles to.
layerThe layer to change.
void Otter.Tilemap.SetLayer ( int  sourceX,
int  sourceY,
string  layer = "" 
)

Set all tiles of a specific layer.

Parameters
sourceXThe X position in the source Texture to use to draw the tiles.
sourceYThe Y position in the source Texture to use to draw the tiles.
layerThe layer to change.
void Otter.Tilemap.SetLayer ( Color  color,
string  layer = "" 
)

Set all tiles of a specific layer.

Parameters
colorThe color to change the tile to.
layerThe layer to change.
void Otter.Tilemap.SetLayer ( int  tileIndex,
Enum  layer 
)

Set all tiles of a specific layer.

Parameters
tileIndexThe index of the tile to change the tiles to.
layerThe layer to change.
void Otter.Tilemap.SetLayer ( int  sourceX,
int  sourceY,
Enum  layer 
)

Set all tiles of a specific layer.

Parameters
sourceXThe X position in the source Texture to use to draw the tiles.
sourceYThe Y position in the source Texture to use to draw the tiles.
layerThe layer to change.
void Otter.Tilemap.SetLayer ( Color  color,
Enum  layer 
)

Set all tiles of a specific layer.

Parameters
colorThe color to change the tile to.
layerThe layer to change.
void Otter.Tilemap.SetRect ( int  tileX,
int  tileY,
int  tileWidth,
int  tileHeight,
Color  color,
string  layer = "" 
)

Set a rectangle area of tiles to a defined color.

Parameters
tileXThe X position of the tile to change.
tileYThe Y position of the tile to change.
tileWidthThe width of tiles to change.
tileHeightThe height of tiles to change.
colorThe color to change the colors to.
layerThe layer to place the tiles on.
void Otter.Tilemap.SetRect ( int  tileX,
int  tileY,
int  tileWidth,
int  tileHeight,
Color  color,
Enum  layer 
)

Set a rectangle area of tiles to a defined color.

Parameters
tileXThe X position of the tile to change.
tileYThe Y position of the tile to change.
tileWidthThe width of tiles to change.
tileHeightThe height of tiles to change.
colorThe color to change the colors to.
layerThe layer to place the tiles on.
void Otter.Tilemap.SetRect ( int  tileX,
int  tileY,
int  tileWidth,
int  tileHeight,
int  sourceX,
int  sourceY,
string  layer = "" 
)

Set a rectangle of tiles to a tile defined by texture coordinates.

Parameters
tileXThe X position of the rectangle to change.
tileYThe Y position of the rectangle to change.
tileWidthThe width of tiles to change.
tileHeightThe height of tiles to change.
sourceXThe X position in the source Texture to use to draw the tiles.
sourceYThe Y position in the source Texture to use to draw the tiles.
layerThe layer to place the tiles on.
void Otter.Tilemap.SetRect ( int  tileX,
int  tileY,
int  tileWidth,
int  tileHeight,
int  sourceX,
int  sourceY,
Enum  layer 
)

Set a rectangle of tiles to a tile defined by texture coordinates.

Parameters
tileXThe X position of the rectangle to change.
tileYThe Y position of the rectangle to change.
tileWidthThe width of tiles to change.
tileHeightThe height of tiles to change.
sourceXThe X position in the source Texture to use to draw the tiles.
sourceYThe Y position in the source Texture to use to draw the tiles.
layerThe layer to place the tiles on.
void Otter.Tilemap.SetRect ( int  tileX,
int  tileY,
int  tileWidth,
int  tileHeight,
int  tileIndex,
string  layer = "" 
)

Set a rectangle of tiles to a tile defined by an index.

Parameters
tileXThe X position of the rectangle to change.
tileYThe Y position of the rectangle to change.
tileWidthThe width of tiles to change.
tileHeightThe height of tiles to change.
tileIndexThe index of the tile to change the tiles to.
layerThe layer to place the tiles on.
void Otter.Tilemap.SetRect ( int  tileX,
int  tileY,
int  tileWidth,
int  tileHeight,
int  tileIndex,
Enum  layer 
)

Set a rectangle of tiles to a tile defined by an index.

Parameters
tileXThe X position of the rectangle to change.
tileYThe Y position of the rectangle to change.
tileWidthThe width of tiles to change.
tileHeightThe height of tiles to change.
tileIndexThe index of the tile to change the tiles to.
layerThe layer to place the tiles on.
TileInfo Otter.Tilemap.SetTile ( int  tileX,
int  tileY,
Color  color,
string  layer = "" 
)

Set a tile to a specific color.

Parameters
tileXThe tile's x position on the map.
tileYThe tile's y position on the map.
colorThe tile's color.
layerThe tile's layer.
Returns
The TileInfo of the altered tile.
TileInfo Otter.Tilemap.SetTile ( int  tileX,
int  tileY,
Color  color,
Enum  layer 
)

Set a tile to a specific color.

Parameters
tileXThe tile's x position on the map.
tileYThe tile's y position on the map.
colorThe tile's color.
layerThe tile's layer.
Returns
The TileInfo of the altered tile.
TileInfo Otter.Tilemap.SetTile ( int  tileX,
int  tileY,
int  sourceX,
int  sourceY,
string  layer = "" 
)

Set a tile to a specific tile from the source texture.

Parameters
tileXThe tile's X position on the map.
tileYThe tile's Y position on the map.
sourceXThe source X position from the tile map in pixels.
sourceYThe source Y position from the tile map in pixels.
layerThe tile's layer.
Returns
The TileInfo for the altered tile.
TileInfo Otter.Tilemap.SetTile ( int  tileX,
int  tileY,
int  sourceX,
int  sourceY,
Enum  layer 
)

Set a tile to a specific tile from the source texture.

Parameters
tileXThe tile's X position on the map.
tileYThe tile's Y position on the map.
sourceXThe source X position from the tile map in pixels.
sourceYThe source Y position from the tile map in pixels.
layerThe tile's layer.
Returns
The TileInfo for the altered tile.
TileInfo Otter.Tilemap.SetTile ( XmlElement  e)

Load tile data from an XmlElement.

Parameters
eAn XmlElement containing attributes x, y, tx, and ty.
Returns
The TileInfo for the loaded tile.
TileInfo Otter.Tilemap.SetTile ( int  tileX,
int  tileY,
int  tileIndex,
string  layer = "" 
)

Set a tile on the Tilemap to a specific tile.

Parameters
tileXThe X position of the tile to change.
tileYThe Y position of the tile to change.
tileIndexThe index of the tile to change to.
layer
Returns
The TileInfo from the altered tile.
TileInfo Otter.Tilemap.SetTile ( int  tileX,
int  tileY,
int  tileIndex,
Enum  layer 
)

Set a tile on the Tilemap to a specific tile.

Parameters
tileXThe X position of the tile to change.
tileYThe Y position of the tile to change.
tileIndexThe index of the tile to change to.
Returns
The TileInfo from the altered tile.
TileInfo Otter.Tilemap.SetTile ( int  tileX,
int  tileY,
bool  flipX,
bool  flipY 
)

Set a tile on the Tilemap to be flipped horizontally and/or vertically.

Parameters
tileXThe X position of the tile to change.
tileYThe Y position of the tile to change.
flipXWhether the tile should be horizontally flipped.
flipYWhether the tile should be vertically flipped.
Returns
The TileInfo from the altered tile.
override void Otter.Tilemap.UpdateDrawable ( )
protectedvirtual

Updates the internal SFML data for rendering.

Reimplemented from Otter.Graphic.

Member Data Documentation

string Otter.Tilemap.DefaultLayerName = "base"

The default layer name to use.

bool Otter.Tilemap.UsePositions

Determines if the X and Y positions of tiles are interpreted as pixels or tile coords.

Property Documentation

int Otter.Tilemap.TileColumns
getset

The number of columsn in the entire tilemap.

int Otter.Tilemap.TileHeight
getset

The height in pixels of each tile.

SortedDictionary<int, List<TileInfo> > Otter.Tilemap.TileLayers
getset

The tile layers to render.

int Otter.Tilemap.TileRows
getset

The number of rows in the entire tilemap.

int Otter.Tilemap.TileWidth
getset

The width in pixels of each tile.


The documentation for this class was generated from the following file: