Function createMask
Generate a mask
from a region of tiles based on a condition.
For each tile in the grid
, sets the corresponding element of mask
to the result of fn(tile).
If a coordinate is out of bounds (e.g. if you are generating a mask
from a slice that extends
over the map border) the mask
value is the init value of the mask
's element type.
Prototype
void createMask(alias fn, T, U)( T grid, RowCol offset, ref U mask ) if (__traits(compiles, () { mask[0][0] = fn(grid.tileAt(RowCol(0, 0))); } ));
Parameters
Name | Description |
---|---|
fn | function that generates a mask entry from a tile |
grid | grid to generate mask from |
offset | map coord from which to start the top-left corner of the mask |
mask | rectangular array to populate with generated mask values.
must match the size of the grid |
Authors
Copyright
Copyright © 2015, Ryan Roden-Corrent