docs: add README.md

This commit is contained in:
2024-12-25 19:23:42 +02:00
parent cd4f369108
commit 389c8ee1fd
4 changed files with 128 additions and 2 deletions

View File

@@ -168,8 +168,8 @@ impl MazeBuilder {
///
/// // Should succeed with radius
/// let result = MazeBuilder::new()
/// .with_radius(3)
/// .build();
/// .with_radius(3)
/// .build();
/// assert!(result.is_ok());
///
/// let maze = result.unwrap();

View File

@@ -1,3 +1,38 @@
//! Hexlab is a 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
//! - Multiple maze generation algorithms
//! - Maze builder pattern for easy maze creation
//!
//! # Examples
//!
//! Here's a quick example to create a simple hexagonal maze:
//!
//!```
//! 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);
//!```
//!
//! # Acknowledgements
//!
//! Hexlab relies on the excellent [hexx](https://github.com/ManevilleF/hexx) library for handling
//! hexagonal grid mathematics, coordinates, and related operations.
mod builder;
mod generator;
mod hex_maze;
@@ -10,6 +45,7 @@ pub use hex_maze::HexMaze;
pub use hex_tile::HexTile;
pub use walls::Walls;
/// Prelude module containing commonly used types
pub mod prelude {
pub use super::{GeneratorType, HexMaze, HexTile, MazeBuilder, MazeBuilderError, Walls};
pub use hexx::{EdgeDirection, Hex, HexLayout};