Struct RectGrid
A grid of rectangular tiles. Wraps a 2D array to provide grid-based access to tiles.
Constructors
Name | Description |
---|---|
this
|
Construct a grid from a 2D tile array. See rectGrid for a constructor with type inference.
|
Methods
Name | Description |
---|---|
adjacentTiles
|
Return all tiles adjacent to the tile at the given coord (not including the tile itself).
|
allCoords
|
Get a range that iterates through every coordinate in the grid. |
allTiles
|
Get a range that iterates through every tile in the grid. |
contains
|
True if the grid coordinate is within the grid bounds. |
numCols
|
Number of columns along a grid's x axis. |
numRows
|
Number of rows along a grid's y axis. |
numTiles
|
The total number of tiles in a grid. |
opApply
|
Foreach over every tile in the grid. Supports ref .
|
opApply
|
Foreach over every (coord,tile) pair in the grid. Supports ref .
|
tileAt
|
Get the tile at a given position in the grid.
The coord must be in bounds.
|
Aliases
Name | Description |
---|---|
TileType
|
The type used to represent a tile in this grid |
Templates
Name | Description |
---|---|
maskCoords
|
Same as maskTiles , but return coords instead of tiles.
|
maskCoordsAround
|
Same as maskCoords , but centered.
|
maskTiles
|
Select specific tiles from this slice based on a mask. |
maskTilesAround
|
Same as maskTiles , but centered.
|
tilesAt
|
Access tiles via a range of coords. Tiles are returned by ref. |
Authors
Copyright
Copyright © 2015, Ryan Roden-Corrent