| Crates.io | hexlab |
| lib.rs | hexlab |
| version | 0.6.1 |
| created_at | 2024-11-12 15:03:50.668287+00 |
| updated_at | 2025-01-14 11:13:38.746483+00 |
| description | A hexagonal maze generation and manipulation library |
| homepage | https://github.com/kristoferssolo/hexlab |
| repository | https://github.com/kristoferssolo/hexlab |
| max_upload_size | |
| id | 1445064 |
| size | 192,993 |
Hexlab is a Rust library for generating and manipulating hexagonal mazes.
Add hexlab as a dependency:
cargo add hexlab
use hexlab::prelude::*;
fn main() {
// Create a new maze with radius 5
let maze = MazeBuilder::new()
.with_radius(5)
.build()
.expect("Failed to create maze");
println!("Maze size: {}", maze.len());
}
use hexlab::prelude::*;
// Create a new maze
let maze = MazeBuilder::new()
.with_radius(5)
.build()
.expect("Failed to create maze");
// Get a specific tile
let tile = maze.get_tile(&Hex::new(1, -1)).unwrap();
// Check if a wall exists
let has_wall = tile.walls().contains(EdgeDirection::FLAT_NORTH);
Full documentation is available at docs.rs.
Contributions are welcome! Please feel free to submit a Pull Request.
Hexlab relies on the excellent hexx library for handling hexagonal grid mathematics, coordinates, and related operations. We're grateful for the robust foundation it provides for working with hexagonal grids.
This project is dual-licensed under either:
at your option.