Skip to content
pure rust field of view algorithms for 2D roguelikes
Rust Shell
Branch: master
Clone or download
Latest commit 3e76048 Jun 16, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ci initial import Jun 13, 2019
examples initial import Jun 13, 2019
src initial import Jun 13, 2019
static initial import Jun 13, 2019
.gitignore initial import Jun 13, 2019
.travis.yml initial import Jun 13, 2019
CHANGELOG.md add missing metadata Jun 15, 2019
CREDITS.md initial import Jun 13, 2019
Cargo.toml add missing metadata Jun 15, 2019
LICENSE initial import Jun 13, 2019
README.md license badge Jun 16, 2019

README.md

doryen-fov

Build Status Documentation crates.io License: MIT

A pure rust library containing 2D field of view algorithms for roguelikes.

compilation instructions

native compilation

cargo run --example fov

web assembly compilation

rustup target install wasm32-unknown-unknown
cargo install cargo-web
cargo web start --example fov

usage

Cargo.toml :

[dependency]
doryen-fov="*"

main.rs :

use doryen_fov::{FovAlgorithm, FovRecursiveShadowCasting, MapData};

fn main() {
    let mut fov = FovRecursiveShadowCasting::new();
    let map_width = 10;
    let map_height = 10;
    let mut map = MapData::new(map_width, map_height); // build an empty map
    map.set_transparent(5, 5, false); // put some wall
    let radius = 0;
    let player_x = 5;
    let player_y = 6;
    map.clear_fov(); // compute_fov does not clear the existing fov
    fov.compute_fov(&mut map, player_x, player_y, radius, false);
    assert!(map.is_in_fov(5, 7));
}

license

This code is released under the MIT license.

contributions

You can contribute to this library through pull requests. If you do so, please update the CHANGELOG.md and CREDITS.md files. If you provide a new feature, consider adding an example as a tutorial/showcase.

You can’t perform that action at this time.