Go to file
Kristofers Solo 81991027bb
Some checks failed
CI / build-and-test (push) Has been cancelled
fix: clippy warnings
2025-09-25 11:40:42 +03:00
.github/workflows fix: clippy warnings 2025-09-25 11:40:42 +03:00
src fix: clippy warnings 2025-09-25 11:40:42 +03:00
tests fix: clippy warnings 2025-09-25 11:40:42 +03:00
.gitignore Initial commit 2024-11-06 10:27:20 +02:00
Cargo.lock docs(pathfinding): add docstrings 2025-01-14 13:06:47 +02:00
Cargo.toml docs(pathfinding): add docstrings 2025-01-14 13:06:47 +02:00
LICENSE-APACHE Create LICENSE 2024-11-06 11:45:23 +02:00
LICENSE-MIT Create LICENSE 2024-11-06 11:45:23 +02:00
README.md docs: fix method name 2025-01-20 21:11:55 +02:00

Hexlab

Hexlab is a Rust library for generating and manipulating hexagonal mazes.

Features

  • Create hexagonal mazes of configurable size
  • Customizable maze properties (radius, start position, seed)
  • Efficient bit-flag representation of walls for optimized memory usage
  • Multiple maze generation algorithms (WIP)
  • Maze builder pattern for easy and flexible maze creation

Installation

Add hexlab as a dependency:

cargo add hexlab

Getting Started

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.count());
}

Usage

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);

Documentation

Full documentation is available at docs.rs.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgements

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.

License

This project is dual-licensed under either:

at your option.