Struct rpgtools::map::GridMap[][src]

pub struct GridMap { /* fields omitted */ }

Implementations

impl GridMap[src]

pub fn new(xmax: usize, ymax: usize) -> GridMap[src]

Make a new GridMap

pub fn place_entrance(&mut self, (x, y): (usize, usize))[src]

Set the entrance at a particular location. The cell at this location will be marked as having the entrance area type. Typcially this will be coloured differently on a map.

pub fn place_entrance_near(
    &mut self,
    (x, y): (usize, usize)
) -> Result<(), &'static str>
[src]

Similar to place entrance, however it starts with the coordinates and finds the nearest spot that is already a “room”. This allows entrances to be placed in non-deterministic generators, such as caves.

pub fn place_room(&mut self, (x0, y0): (usize, usize), (x1, y1): (usize, usize))[src]

Set a room

pub fn place_room_dimensions(
    &mut self,
    (x, y): (usize, usize),
    (w, h): (isize, isize)
)
[src]

Place a room by setting the origin and width/height

Arguments:

  • (x, y) -> The origin of the room. This will be a corner.
  • (w, h) -> Width/Height of the room. Note, they’re isize because you can specify the w/h to be left OR right of the origin and up OR down, respectively.

pub fn place_hallway(
    &mut self,
    (x0, y0): (usize, usize),
    (x1, y1): (usize, usize),
    route: RouteMethod
)
[src]

Place a hallway between two points

pub fn generate_random_cells(&mut self, limit: i64)[src]

Generate random cells with a biasing towards more/less rooms. Limit is a value between 1 and 100. This limit sets the chance that the cells are a room. Higher limit means fewer rooms.

pub fn generate_annealed_random_cells(&mut self)[src]

pub fn place_random_room(&mut self, scale: usize, connect: bool)[src]

Place a randomly sized room of up to scale length or width.

pub fn generate_cave(&mut self, iter: i64, seed_limit: i64)[src]

pub fn draw_to_file(&self, filename: &str, scale: usize) -> Result<(), Error>[src]

Make a PNG file of the gridmap

Trait Implementations

impl Clone for GridMap[src]

impl Debug for GridMap[src]

Auto Trait Implementations

impl RefUnwindSafe for GridMap

impl Send for GridMap

impl Sync for GridMap

impl Unpin for GridMap

impl UnwindSafe for GridMap

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,