OrthoMap.containsPoint

True if the pixel position is within the map bounds.

struct OrthoMap(Tile)
bool
containsPoint
(
T
)
(
T pos
)
if (
isPixelCoord!T
)

Examples

1 // 3x5 map, pixel bounds are [0, 0, 160, 96] (32*3 = 96, 32*5 = 160)
2 auto grid = [
3   [ 00, 01, 02, 03, 04, ],
4   [ 10, 11, 12, 13, 14, ],
5   [ 20, 21, 22, 23, 24, ],
6 ];
7 auto map = OrthoMap!int(grid, 32, 32);
8 
9 assert( map.containsPoint(PixelCoord(   0,    0))); // top left
10 assert( map.containsPoint(PixelCoord( 159,   95))); // bottom right
11 assert( map.containsPoint(PixelCoord(  80,   48))); // center
12 assert(!map.containsPoint(PixelCoord(   0,   96))); // beyond right border
13 assert(!map.containsPoint(PixelCoord( 160,    0))); // beyond bottom border
14 assert(!map.containsPoint(PixelCoord(   0, -0.5))); // beyond left border
15 assert(!map.containsPoint(PixelCoord(-0.5,    0))); // beyond top border

Meta