Table of Contents

Class IndividualTiledMapRenderer

Namespace
MLEM.Extended.Tiled
Assembly
MLEM.Extended.dll

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

map TiledMap

The map to use

depthFunction IndividualTiledMapRenderer.GetDepth

The 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

batch StaticSpriteBatch

The static sprite batch to use for drawing.

frustum RectangleF?

The area that is visible, in pixel space.

addFunction IndividualTiledMapRenderer.AddDelegate

The 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

batch StaticSpriteBatch

The static sprite batch to use for drawing.

layerIndex int

The index of the layer in MonoGame.Extended.Tiled.TiledMap.TileLayers.

frustum RectangleF?

The area that is visible, in pixel space.

addFunction IndividualTiledMapRenderer.AddDelegate

The 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

batch StaticSpriteBatch

The static sprite batch to use for drawing.

info IndividualTiledMapRenderer.TileDrawInfo

The 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

batch SpriteBatch

The sprite batch to use for drawing

info IndividualTiledMapRenderer.TileDrawInfo

The 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

batch SpriteBatch

The sprite batch to use

frustum RectangleF?

The area that is visible, in pixel space.

drawFunction IndividualTiledMapRenderer.DrawDelegate

The 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

batch SpriteBatch

The sprite batch to use

layerIndex int

The index of the layer in MonoGame.Extended.Tiled.TiledMap.TileLayers

frustum RectangleF?

The area that is visible, in pixel space.

drawFunction IndividualTiledMapRenderer.DrawDelegate

The 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

map TiledMap

The map to use

depthFunction IndividualTiledMapRenderer.GetDepth

The 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

time GameTime

The 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)

Parameters

layerIndex int

The index of the layer in MonoGame.Extended.Tiled.TiledMap.TileLayers

x int

The x coordinate of the tile

y int

The y coordinate of the tile