specs_scene_graph

Crates.iospecs_scene_graph
lib.rsspecs_scene_graph
version0.3.0
sourcesrc
created_at2018-06-28 20:32:44.11251
updated_at2019-07-05 22:03:27.469421
descriptionscene graph for specs
homepagehttps://gitlab.com/nathanfaucett/rs-specs_scene_graph
repositoryhttps://gitlab.com/nathanfaucett/rs-specs_scene_graph.git
max_upload_size
id72154
size19,733
Nathan Faucett (nathanfaucett)

documentation

README

specs_scene_graph

scene graph for specs

use specs_scene_graph::{SceneGraphBundle, Parent as SceneGraphParent};

#[derive(Debug)]
struct Parent {
    entity: Entity,
}

impl Parent {
    #[inline(always)]
    pub fn new(entity: Entity) -> Self {
        Parent { entity: entity }
    }
}

impl Component for Parent {
    type Storage = FlaggedStorage<Self, DenseVecStorage<Self>>;
}

impl SceneGraphParent for Parent {
    #[inline(always)]
    fn parent_entity(&self) -> Entity {
        self.entity
    }
}

let mut world = World::new();

let mut dispatcher = SpecsBundler::new(&mut world, DispatcherBuilder::new())
    .bundle(SceneGraphBundle::<Parent>::default())
    .unwrap()
    .build();

// track modified/removed events from the scene graph
let mut reader_id = world.write_resource::<SceneGraph<Parent>>().track();
Commit count: 7

cargo fmt