[][src]Crate mapgen

Generators for dungeon type maps.

Generators can bu used directly or they can be combined with MapGenerators and MapModifiers

  • MapGenerators are use to create initial map.
  • MapModifiers modify existing map.

Example

use mapgen::{MapFilter, MapBuilder, Map, TileType};
use mapgen::filter::{
    NoiseGenerator,
    CellularAutomata,
    starting_point::{AreaStartingPosition, XStart, YStart}
};
use mapgen::geometry::Point;
 
let map = MapBuilder::new(80, 50)
            .with(NoiseGenerator::uniform())
            .with(CellularAutomata::new())
            .with(AreaStartingPosition::new(XStart::CENTER, YStart::CENTER))
            .build();
 
assert_eq!(map.width, 80);
assert_eq!(map.height, 50);
assert_eq!(map.starting_point.is_some(), true);

Re-exports

pub use map::Map;
pub use map::Symmetry;
pub use map::TileType;
pub use filter::*;

Modules

filter

Generators for dungeon type maps.

geometry

Support function for 2D geometry

map

Map structure contains information about tiles and other elements on the map.

Structs

MapBuilder

Used to chain MapBuilder and MapModifiers to create the final map.

Traits

MapFilter

Trait which should be implemented by map modifier. Modifier takes initiall map and apply changes to it.