# grid-map
[](https://crates.io/crates/grid-map)
[](https://docs.rs/grid-map)
[](https://opensource.org/licenses/MIT)
This library provides two-dimensional grid maps.
There is support for square and hexagonal grids as well as multiple coordinate integer sizes.
## Features
You must choose the scale and grid type, or use the default.
Map Configuration Examples:
```toml
# 32-bit square map
grid-map = "0.1.0-rc.2"
# 16-bit hexagonal map (with flat tops)
world-map = { package = "grid-map", version = "0.1.0-rc.2", features = ["scale-16", "hex-flat"] }
# 8-bit hexagonal map with pointy tops
city-map = { package = "grid-map", version = "0.1.0-rc.2", features = ["scale-8", "hex-pointy"] }
```
### Scale (mutually exclusive, default: `scale-32`)
- `scale-8` -- `u8` coordinates
- `scale-16` -- `u16` coordinates
- `scale-32` -- `u32` coordinates
### Grid Type (mutually exclusive, default: `square`)
- `square` -- 4 directions (North, East, South, West)
- `hex-flat` -- 6 directions, flat-top hex (North, NorthEast, SouthEast, South, SouthWest, NorthWest)
- `hex-pointy` -- 6 directions, pointy-top hex (NorthEast, East, SouthEast, SouthWest, West, NorthWest)
## Types
- `Scale` -- the coordinate type (`u8`, `u16`, or `u32`)
- `Dim` -- grid dimensions (width, height)
- `Loc` -- grid location (x, y)
- `Dir` -- cardinal directions (varies by grid type)
- `GridMap<T>` -- a two-dimensional grid map