Class IndividualTiledMapRenderer
A tiled map renderer that renders each tile individually, while optionally supplying a depth for each tile. Rendering in this manner allows for entities to be behind or in front of buildings based on their y height.
public class IndividualTiledMapRenderer
- Inheritance
-
IndividualTiledMapRenderer
- Inherited Members
Constructors
IndividualTiledMapRenderer(TiledMap, GetDepth)
Creates a new individual tiled map renderer using the given map and depth function
public IndividualTiledMapRenderer(TiledMap map = null, IndividualTiledMapRenderer.GetDepth depthFunction = null)
Parameters
mapTiledMapThe map to use
depthFunctionIndividualTiledMapRenderer.GetDepthThe depth function to use. Defaults to a function that assigns a depth of 0 to every tile.
Methods
Add(StaticSpriteBatch, RectangleF?, AddDelegate)
Adds this individual tiled map renderer to the given StaticSpriteBatch. Optionally, a frustum can be supplied that determines which positions, in pixel space, are visible at this time. Camera provides GetVisibleRectangle() for this purpose.
public void Add(StaticSpriteBatch batch, RectangleF? frustum = null, IndividualTiledMapRenderer.AddDelegate addFunction = null)
Parameters
batchStaticSpriteBatchThe static sprite batch to use for drawing.
frustumRectangleF?The area that is visible, in pixel space.
addFunctionIndividualTiledMapRenderer.AddDelegateThe add function to use, or null to use DefaultAdd(StaticSpriteBatch, TileDrawInfo).
AddLayer(StaticSpriteBatch, int, RectangleF?, AddDelegate)
Adds the given layer of this individual tiled map renderer to the given StaticSpriteBatch. Optionally, a frustum can be supplied that determines which positions, in pixel space, are visible at this time. Camera provides GetVisibleRectangle() for this purpose.
public void AddLayer(StaticSpriteBatch batch, int layerIndex, RectangleF? frustum = null, IndividualTiledMapRenderer.AddDelegate addFunction = null)
Parameters
batchStaticSpriteBatchThe static sprite batch to use for drawing.
layerIndexintThe index of the layer in MonoGame.Extended.Tiled.TiledMap.TileLayers.
frustumRectangleF?The area that is visible, in pixel space.
addFunctionIndividualTiledMapRenderer.AddDelegateThe add function to use, or null to use DefaultAdd(StaticSpriteBatch, TileDrawInfo).
DefaultAdd(StaticSpriteBatch, TileDrawInfo)
The default implementation of IndividualTiledMapRenderer.AddDelegate that is used by Add(StaticSpriteBatch, RectangleF?, AddDelegate) if no custom add function is passed.
public static void DefaultAdd(StaticSpriteBatch batch, IndividualTiledMapRenderer.TileDrawInfo info)
Parameters
batchStaticSpriteBatchThe static sprite batch to use for drawing.
infoIndividualTiledMapRenderer.TileDrawInfoThe IndividualTiledMapRenderer.TileDrawInfo to add.
DefaultDraw(SpriteBatch, TileDrawInfo)
The default implementation of IndividualTiledMapRenderer.DrawDelegate that is used by Draw(SpriteBatch, RectangleF?, DrawDelegate) if no custom draw function is passed.
public static void DefaultDraw(SpriteBatch batch, IndividualTiledMapRenderer.TileDrawInfo info)
Parameters
batchSpriteBatchThe sprite batch to use for drawing
infoIndividualTiledMapRenderer.TileDrawInfoThe IndividualTiledMapRenderer.TileDrawInfo to draw
Draw(SpriteBatch, RectangleF?, DrawDelegate)
Draws this individual tiled map renderer. Optionally, a frustum can be supplied that determines which positions, in pixel space, are visible at this time. Camera provides GetVisibleRectangle() for this purpose.
public void Draw(SpriteBatch batch, RectangleF? frustum = null, IndividualTiledMapRenderer.DrawDelegate drawFunction = null)
Parameters
batchSpriteBatchThe sprite batch to use
frustumRectangleF?The area that is visible, in pixel space.
drawFunctionIndividualTiledMapRenderer.DrawDelegateThe draw function to use, or null to use DefaultDraw(SpriteBatch, TileDrawInfo)
DrawLayer(SpriteBatch, int, RectangleF?, DrawDelegate)
Draws the given layer of this individual tiled map renderer. Optionally, a frustum can be supplied that determines which positions, in pixel space, are visible at this time. Camera provides GetVisibleRectangle() for this purpose.
public void DrawLayer(SpriteBatch batch, int layerIndex, RectangleF? frustum = null, IndividualTiledMapRenderer.DrawDelegate drawFunction = null)
Parameters
batchSpriteBatchThe sprite batch to use
layerIndexintThe index of the layer in MonoGame.Extended.Tiled.TiledMap.TileLayers
frustumRectangleF?The area that is visible, in pixel space.
drawFunctionIndividualTiledMapRenderer.DrawDelegateThe draw function to use, or null to use DefaultDraw(SpriteBatch, TileDrawInfo)
SetMap(TiledMap, GetDepth)
Sets this individual tiled map renderer's map and depth function
public void SetMap(TiledMap map, IndividualTiledMapRenderer.GetDepth depthFunction = null)
Parameters
mapTiledMapThe map to use
depthFunctionIndividualTiledMapRenderer.GetDepthThe depth function to use. Defaults to a function that assigns a depth of 0 to every tile.
UpdateAnimations(GameTime)
Update all of the animated tiles in this individual tiled map renderer
public void UpdateAnimations(GameTime time)
Parameters
timeGameTimeThe game's time
UpdateDrawInfo(int, int, int)
Updates the rendering information for the tile in the given layer, x and y.
public void UpdateDrawInfo(int layerIndex, int x, int y)