dungen_minion

Crates.iodungen_minion
lib.rsdungen_minion
version0.3.2
sourcesrc
created_at2020-10-08 18:02:35.933707
updated_at2021-09-20 20:49:20.028051
descriptionA dungeon generator focused on 2D roguelikes.
homepagehttps://github.com/MouseProducedGames/dungen_minion
repositoryhttps://github.com/MouseProducedGames/dungen_minion
max_upload_size
id297341
size67,502
(MouseProducedGames)

documentation

README

Usage

Advanced Usage

See the documentation for further details.

Basic Usage

// External includes.
use dungen_minion::geometry::*;
use dungen_minion::*;

// Standard includes.

// Internal includes.

fn main() {
    // Create a dungeon generator using RoomHashMap.
    // RoomHashMap is expandable, and has no explicit size restrictions.
    let dungen = DunGen::new(Box::new(RoomHashMap::default()))
        // Expand the room to a width of 40, and a height of 30.
        // TileType::Floor will be placed.
        .gen_with(EmptyRoomDunGen::new(Size::new(40, 30)))
        // Create walls for the room.
        .gen::<WalledRoomDunGen>()
        .build();
   
    // A simple drawing routine.
    for y in 0..dungen.size().height() {
        for x in 0..dungen.size().width() {
            let tile_type = dungen.tile_type_at_local(LocalPosition::new(x, y));
            if tile_type.is_none() {
                continue;
            }
   
            // The selection of tiles is deliberately limited, for now.
            // Theming is included in future plans for dungen_minion.
            let tile_type = tile_type.unwrap();
            let ch = match tile_type {
                TileType::Void => ' ',
                TileType::Floor => '.',
                TileType::Wall => '#',
                TileType::Portal => '+',
            };
   
            print!("{}", ch);
        }
        println!();
    }
}
Commit count: 0

cargo fmt