mirror of
https://github.com/kristoferssolo/hexlab.git
synced 2026-03-22 00:26:26 +00:00
docs: add README.md
This commit is contained in:
@@ -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();
|
||||
|
||||
36
src/lib.rs
36
src/lib.rs
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user