Struct tcod::bsp::Bsp [] [src]

pub struct Bsp<'a> { /* fields omitted */ }

This struct encapsulates TCOD_bsp_t. It mirrors original's fields (x, y, etc.) with the exception of horizontal. See example.

Examples

let mut bsp = Bsp::new_with_size(0, 0, 50, 60);

assert_eq!(bsp.x, 0);
assert_eq!(bsp.y, 0);
assert_eq!(bsp.w, 50);
assert_eq!(bsp.h, 60);
assert_eq!(bsp.horizontal(), false);

bsp.x = 10;
bsp.y = 20;
bsp.set_horizontal(true);

Methods

impl<'a> Bsp<'a>
[src]

Returns Some(Bsp) with left subtree, or None if the BSP has not been split.

Returns Some(Bsp) with right subtree, or None if the BSP has not been split.

Returns Some(Bsp) with father, or None if the node is root.

Instead of 5 traverse* functions as in original API, Rust binding provides a single traverse function with an order parameter.

Examples

   let bsp = Bsp::new_with_size(0, 0, 50, 50);
   let mut counter = 0;

   bsp.traverse(TraverseOrder::PreOrder, |node| {
       counter += 1;
       true
   });
   assert_eq!(counter, 1);

Trait Implementations

impl<'a> Deref for Bsp<'a>
[src]

The resulting type after dereferencing

The method called to dereference a value

impl<'a> DerefMut for Bsp<'a>
[src]

The method called to mutably dereference a value

impl<'a> Debug for Bsp<'a>
[src]

Formats the value using the given formatter.

impl<'a> Drop for Bsp<'a>
[src]

A method called when the value goes out of scope. Read more