dtiled.grid

A grid wraps a 2D array to provide specialized grid-based functionality.

Currently, the only grid type is RectGrid, which can serve as the base for an orthogonal or isometric map. HexGrid may be added in a later version to support hexagonal maps.

Members

Functions

createMask
void createMask(T grid, RowCol offset, ref U mask)

Generate a mask from a region of tiles based on a condition.

createMaskAround
void createMaskAround(T grid, RowCol center, ref U mask)

Same as createMask, but specify the offset of the mask's center rather than the top-left corner.

rectGrid
auto rectGrid(T tiles)

Convenience function to wrap a RectGrid around a 2D array.

Structs

RectGrid
struct RectGrid(T)

A grid of rectangular tiles. Wraps a 2D array to provide grid-based access to tiles.

Examples

1 import std.container : Array;
2 
3 static assert(isArray2D!(int[][]));
4 static assert(isArray2D!(char[3][5]));
5 static assert(isArray2D!(Array!(Array!int)));

Meta