Class AutoTiling
This class contains a DrawAutoTile(SpriteBatch, Vector2, TextureRegion, ConnectsTo, Color, Vector2?, Vector2?, float) method that allows users to easily draw a tile with automatic connections, as well as a more complex DrawExtendedAutoTile(SpriteBatch, Vector2, TextureRegion, TextureRegion, ConnectsTo, Color, Color, Vector2?, Vector2?, float, float) method. Note that StaticSpriteBatch can also be used for drawing by using the AddAutoTile(StaticSpriteBatch, Vector2, TextureRegion, ConnectsTo, Color, Vector2?, Vector2?, float, ICollection<Item>) and AddExtendedAutoTile(StaticSpriteBatch, Vector2, TextureRegion, TextureRegion, ConnectsTo, Color, Color, Vector2?, Vector2?, float, float, ICollection<Item>) methods instead.
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static class AutoTiling
- Inheritance
-
AutoTiling
- Inherited Members
Methods
AddAutoTile(StaticSpriteBatch, Vector2, TextureRegion, ConnectsTo, Color, Vector2?, Vector2?, float, ICollection<Item>)
This method allows for a tiled texture to be drawn in an auto-tiling mode. This allows, for example, a grass patch on a tilemap to have nice looking edges that transfer over into a path without any hard edges between tiles.
For auto-tiling in this way to work, the tiles have to be laid out as follows: five tiles aligned horizontally within the texture file, with the following information:
- The texture used for filling big areas
- The texture used for straight, horizontal borders, with the borders facing away from the center
- The texture used for outer corners, with the corners facing away from the center
- The texture used for straight, vertical borders, with the borders facing away from the center
- The texture used for inner corners, with the corners facing away from the center
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static void AddAutoTile(StaticSpriteBatch batch, Vector2 pos, TextureRegion texture, AutoTiling.ConnectsTo connectsTo, Color color, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0, ICollection<StaticSpriteBatch.Item> items = null)
Parameters
batchStaticSpriteBatchThe sprite batch to use for drawing.
posVector2The position to draw at.
textureTextureRegionThe texture to use for drawing, with the area set to the first texture region, as described in the summary.
connectsToAutoTiling.ConnectsToA function that determines whether two positions should connect.
colorColorThe color to draw with.
originVector2?The origin to draw from.
scaleVector2?The scale to draw with.
layerDepthfloatThe layer depth to draw with.
itemsICollection<StaticSpriteBatch.Item>
AddExtendedAutoTile(StaticSpriteBatch, Vector2, TextureRegion, TextureRegion, ConnectsTo, Color, Color, Vector2?, Vector2?, float, float, ICollection<Item>)
This method allows for a tiled texture to be drawn in an auto-tiling mode. This allows, for example, a grass patch on a tilemap to have nice looking edges that transfer over into a path without any hard edges between tiles.
This method is a more complex version of DrawAutoTile(SpriteBatch, Vector2, TextureRegion, ConnectsTo, Color, Vector2?, Vector2?, float) that overlays separate border textures on a background texture region, which also allows for non-rectangular texture areas to be used easily. For auto-tiling in this way to work, the overlay sections have to be laid out as follows: 16 sections aligned horizontally within the texture file, with the following information:
- The texture used for straight, horizontal borders, with the borders facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for outer corners, with the corners facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for straight, vertical borders, with the borders facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for inner corners, with the corners facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static void AddExtendedAutoTile(StaticSpriteBatch batch, Vector2 pos, TextureRegion backgroundTexture, TextureRegion overlayTexture, AutoTiling.ConnectsTo connectsTo, Color backgroundColor, Color overlayColor, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0, float overlayDepthOffset = 0, ICollection<StaticSpriteBatch.Item> items = null)
Parameters
batchStaticSpriteBatchThe sprite batch to use for drawing.
posVector2The position to draw at.
backgroundTextureTextureRegionThe background region, or null to skip drawing a background.
overlayTextureTextureRegionThe first overlay region, as described in the summary.
connectsToAutoTiling.ConnectsToA function that determines whether two positions should connect.
backgroundColorColorThe color to draw the texture used for filling big areas with.
overlayColorColorThe color to draw border and corner textures with.
originVector2?The origin to draw from.
scaleVector2?The scale to draw with.
layerDepthfloatThe layer depth to draw with.
overlayDepthOffsetfloatAn optional depth offset from
layerDepththat the overlay should be drawn withitemsICollection<StaticSpriteBatch.Item>
AddExtendedAutoTile(StaticSpriteBatch, Vector2, TextureRegion, Func<int, TextureRegion>, ConnectsTo, Color, Color, Vector2?, Vector2?, float, float, ICollection<Item>)
This method allows for a tiled texture to be drawn in an auto-tiling mode. This allows, for example, a grass patch on a tilemap to have nice looking edges that transfer over into a path without any hard edges between tiles.
This method is a more complex version of DrawAutoTile(SpriteBatch, Vector2, TextureRegion, ConnectsTo, Color, Vector2?, Vector2?, float) that overlays separate border textures on a background texture region, which also allows for non-rectangular texture areas to be used easily. For auto-tiling in this way to work, the overlay sections have to be laid out as follows: 16 sections aligned horizontally within the texture file, with the following information:
- The texture used for straight, horizontal borders, with the borders facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for outer corners, with the corners facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for straight, vertical borders, with the borders facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for inner corners, with the corners facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static void AddExtendedAutoTile(StaticSpriteBatch batch, Vector2 pos, TextureRegion backgroundTexture, Func<int, TextureRegion> overlayTextures, AutoTiling.ConnectsTo connectsTo, Color backgroundColor, Color overlayColor, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0, float overlayDepthOffset = 0, ICollection<StaticSpriteBatch.Item> items = null)
Parameters
batchStaticSpriteBatchThe sprite batch to use for drawing.
posVector2The position to draw at.
backgroundTextureTextureRegionThe background region, or null to skip drawing a background.
overlayTexturesFunc<int, TextureRegion>connectsToAutoTiling.ConnectsToA function that determines whether two positions should connect.
backgroundColorColorThe color to draw the texture used for filling big areas with.
overlayColorColorThe color to draw border and corner textures with.
originVector2?The origin to draw from.
scaleVector2?The scale to draw with.
layerDepthfloatThe layer depth to draw with.
overlayDepthOffsetfloatAn optional depth offset from
layerDepththat the overlay should be drawn withitemsICollection<StaticSpriteBatch.Item>
AddExtendedAutoTileCorner(StaticSpriteBatch, Vector2, TextureRegion, ConnectsTo, Color, Direction2, Vector2?, Vector2?, float, ICollection<Item>)
This method allows for a single corner of a tiled texture to be drawn in an auto-tiling mode. This allows, for example, a grass patch on a tilemap to have nice looking edges that transfer over into a path without any hard edges between tiles.
For more information, and to draw all four corners at once, see DrawExtendedAutoTile(SpriteBatch, Vector2, TextureRegion, TextureRegion, ConnectsTo, Color, Color, Vector2?, Vector2?, float, float)
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static void AddExtendedAutoTileCorner(StaticSpriteBatch batch, Vector2 pos, TextureRegion overlayTexture, AutoTiling.ConnectsTo connectsTo, Color overlayColor, Direction2 corner, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0, ICollection<StaticSpriteBatch.Item> items = null)
Parameters
batchStaticSpriteBatchThe sprite batch to use for drawing.
posVector2The position to draw at.
overlayTextureTextureRegionThe first overlay region, as described in the summary.
connectsToAutoTiling.ConnectsToA function that determines whether two positions should connect.
overlayColorColorThe color to draw border and corner textures with.
cornerDirection2The corner of the auto-tile to draw. Can be UpLeft, UpRight, DownLeft or DownRight.
originVector2?The origin to draw from.
scaleVector2?The scale to draw with.
layerDepthfloatThe layer depth to draw with.
itemsICollection<StaticSpriteBatch.Item>
AddExtendedAutoTileCorner(StaticSpriteBatch, Vector2, Func<int, TextureRegion>, ConnectsTo, Color, Direction2, Vector2?, Vector2?, float, ICollection<Item>)
This method allows for a single corner of a tiled texture to be drawn in an auto-tiling mode. This allows, for example, a grass patch on a tilemap to have nice looking edges that transfer over into a path without any hard edges between tiles.
For more information, and to draw all four corners at once, see DrawExtendedAutoTile(SpriteBatch, Vector2, TextureRegion, TextureRegion, ConnectsTo, Color, Color, Vector2?, Vector2?, float, float)
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static void AddExtendedAutoTileCorner(StaticSpriteBatch batch, Vector2 pos, Func<int, TextureRegion> overlayTextures, AutoTiling.ConnectsTo connectsTo, Color overlayColor, Direction2 corner, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0, ICollection<StaticSpriteBatch.Item> items = null)
Parameters
batchStaticSpriteBatchThe sprite batch to use for drawing.
posVector2The position to draw at.
overlayTexturesFunc<int, TextureRegion>connectsToAutoTiling.ConnectsToA function that determines whether two positions should connect.
overlayColorColorThe color to draw border and corner textures with.
cornerDirection2The corner of the auto-tile to draw. Can be UpLeft, UpRight, DownLeft or DownRight.
originVector2?The origin to draw from.
scaleVector2?The scale to draw with.
layerDepthfloatThe layer depth to draw with.
itemsICollection<StaticSpriteBatch.Item>
DrawAutoTile(SpriteBatch, Vector2, TextureRegion, ConnectsTo, Color, Vector2?, Vector2?, float)
This method allows for a tiled texture to be drawn in an auto-tiling mode. This allows, for example, a grass patch on a tilemap to have nice looking edges that transfer over into a path without any hard edges between tiles.
For auto-tiling in this way to work, the tiles have to be laid out as follows: five tiles aligned horizontally within the texture file, with the following information:
- The texture used for filling big areas
- The texture used for straight, horizontal borders, with the borders facing away from the center
- The texture used for outer corners, with the corners facing away from the center
- The texture used for straight, vertical borders, with the borders facing away from the center
- The texture used for inner corners, with the corners facing away from the center
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static void DrawAutoTile(SpriteBatch batch, Vector2 pos, TextureRegion texture, AutoTiling.ConnectsTo connectsTo, Color color, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0)
Parameters
batchSpriteBatchThe sprite batch to use for drawing.
posVector2The position to draw at.
textureTextureRegionThe texture to use for drawing, with the area set to the first texture region, as described in the summary.
connectsToAutoTiling.ConnectsToA function that determines whether two positions should connect.
colorColorThe color to draw with.
originVector2?The origin to draw from.
scaleVector2?The scale to draw with.
layerDepthfloatThe layer depth to draw with.
DrawExtendedAutoTile(SpriteBatch, Vector2, TextureRegion, TextureRegion, ConnectsTo, Color, Color, Vector2?, Vector2?, float, float)
This method allows for a tiled texture to be drawn in an auto-tiling mode. This allows, for example, a grass patch on a tilemap to have nice looking edges that transfer over into a path without any hard edges between tiles.
This method is a more complex version of DrawAutoTile(SpriteBatch, Vector2, TextureRegion, ConnectsTo, Color, Vector2?, Vector2?, float) that overlays separate border textures on a background texture region, which also allows for non-rectangular texture areas to be used easily. For auto-tiling in this way to work, the overlay sections have to be laid out as follows: 16 sections aligned horizontally within the texture file, with the following information:
- The texture used for straight, horizontal borders, with the borders facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for outer corners, with the corners facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for straight, vertical borders, with the borders facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for inner corners, with the corners facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static void DrawExtendedAutoTile(SpriteBatch batch, Vector2 pos, TextureRegion backgroundTexture, TextureRegion overlayTexture, AutoTiling.ConnectsTo connectsTo, Color backgroundColor, Color overlayColor, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0, float overlayDepthOffset = 0)
Parameters
batchSpriteBatchThe sprite batch to use for drawing.
posVector2The position to draw at.
backgroundTextureTextureRegionThe background region, or null to skip drawing a background.
overlayTextureTextureRegionThe first overlay region, as described in the summary.
connectsToAutoTiling.ConnectsToA function that determines whether two positions should connect.
backgroundColorColorThe color to draw the texture used for filling big areas with.
overlayColorColorThe color to draw border and corner textures with.
originVector2?The origin to draw from.
scaleVector2?The scale to draw with.
layerDepthfloatThe layer depth to draw with.
overlayDepthOffsetfloatAn optional depth offset from
layerDepththat the overlay should be drawn with
DrawExtendedAutoTile(SpriteBatch, Vector2, TextureRegion, Func<int, TextureRegion>, ConnectsTo, Color, Color, Vector2?, Vector2?, float, float)
This method allows for a tiled texture to be drawn in an auto-tiling mode. This allows, for example, a grass patch on a tilemap to have nice looking edges that transfer over into a path without any hard edges between tiles.
This method is a more complex version of DrawAutoTile(SpriteBatch, Vector2, TextureRegion, ConnectsTo, Color, Vector2?, Vector2?, float) that overlays separate border textures on a background texture region, which also allows for non-rectangular texture areas to be used easily. For auto-tiling in this way to work, the overlay sections have to be laid out as follows: 16 sections aligned horizontally within the texture file, with the following information:
- The texture used for straight, horizontal borders, with the borders facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for outer corners, with the corners facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for straight, vertical borders, with the borders facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
- The texture used for inner corners, with the corners facing away from the center, split up into four parts: top left, then top right, then bottom left, then bottom right
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static void DrawExtendedAutoTile(SpriteBatch batch, Vector2 pos, TextureRegion backgroundTexture, Func<int, TextureRegion> overlayTextures, AutoTiling.ConnectsTo connectsTo, Color backgroundColor, Color overlayColor, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0, float overlayDepthOffset = 0)
Parameters
batchSpriteBatchThe sprite batch to use for drawing.
posVector2The position to draw at.
backgroundTextureTextureRegionThe background region, or null to skip drawing a background.
overlayTexturesFunc<int, TextureRegion>connectsToAutoTiling.ConnectsToA function that determines whether two positions should connect.
backgroundColorColorThe color to draw the texture used for filling big areas with.
overlayColorColorThe color to draw border and corner textures with.
originVector2?The origin to draw from.
scaleVector2?The scale to draw with.
layerDepthfloatThe layer depth to draw with.
overlayDepthOffsetfloatAn optional depth offset from
layerDepththat the overlay should be drawn with
DrawExtendedAutoTileCorner(SpriteBatch, Vector2, TextureRegion, ConnectsTo, Color, Direction2, Vector2?, Vector2?, float)
This method allows for a single corner of a tiled texture to be drawn in an auto-tiling mode. This allows, for example, a grass patch on a tilemap to have nice looking edges that transfer over into a path without any hard edges between tiles.
For more information, and to draw all four corners at once, see DrawExtendedAutoTile(SpriteBatch, Vector2, TextureRegion, TextureRegion, ConnectsTo, Color, Color, Vector2?, Vector2?, float, float)
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static void DrawExtendedAutoTileCorner(SpriteBatch batch, Vector2 pos, TextureRegion overlayTexture, AutoTiling.ConnectsTo connectsTo, Color overlayColor, Direction2 corner, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0)
Parameters
batchSpriteBatchThe sprite batch to use for drawing.
posVector2The position to draw at.
overlayTextureTextureRegionThe first overlay region, as described in the summary.
connectsToAutoTiling.ConnectsToA function that determines whether two positions should connect.
overlayColorColorThe color to draw border and corner textures with.
cornerDirection2The corner of the auto-tile to draw. Can be UpLeft, UpRight, DownLeft or DownRight.
originVector2?The origin to draw from.
scaleVector2?The scale to draw with.
layerDepthfloatThe layer depth to draw with.
DrawExtendedAutoTileCorner(SpriteBatch, Vector2, Func<int, TextureRegion>, ConnectsTo, Color, Direction2, Vector2?, Vector2?, float)
This method allows for a single corner of a tiled texture to be drawn in an auto-tiling mode. This allows, for example, a grass patch on a tilemap to have nice looking edges that transfer over into a path without any hard edges between tiles.
For more information, and to draw all four corners at once, see DrawExtendedAutoTile(SpriteBatch, Vector2, TextureRegion, TextureRegion, ConnectsTo, Color, Color, Vector2?, Vector2?, float, float)
[Obsolete("MLEM's auto-tiling system is deprecated and will be removed in a future version. It is recommended to switch to a custom approach or a more robust library.")]
public static void DrawExtendedAutoTileCorner(SpriteBatch batch, Vector2 pos, Func<int, TextureRegion> overlayTextures, AutoTiling.ConnectsTo connectsTo, Color overlayColor, Direction2 corner, Vector2? origin = null, Vector2? scale = null, float layerDepth = 0)
Parameters
batchSpriteBatchThe sprite batch to use for drawing.
posVector2The position to draw at.
overlayTexturesFunc<int, TextureRegion>connectsToAutoTiling.ConnectsToA function that determines whether two positions should connect.
overlayColorColorThe color to draw border and corner textures with.
cornerDirection2The corner of the auto-tile to draw. Can be UpLeft, UpRight, DownLeft or DownRight.
originVector2?The origin to draw from.
scaleVector2?The scale to draw with.
layerDepthfloatThe layer depth to draw with.