specs_transform 0.3.5

transform 2d and 3d component for specs
Documentation

specs_transform

transform 2d and 3d component for specs

extern crate specs;
extern crate specs_bundler;
extern crate specs_transform;


use specs::{World, DispatcherBuilder};
use specs_bundler::SpecsBundler;
use specs_transform::{TransformBundle, Child, LocalTransform3D, Transform3D, , LocalTransform2D, Transform2D};


fn main() {
    let mut world = World::new();

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

    let parent = world.create_entity()
        .with(LocalTransform3D::<f32>::new())
        .with(Transform3D::<f32>::new())
        .build();

    let child = world.create_entity()
        .with(Child::new(parent))
        .with(LocalTransform2D::<f32>::new())
        .with(Transform2D::<f32>::new())
        .build();

    let _ = world.create_entity()
        .with(Child::new(child))
        .with(LocalTransform3D::<f32>::new())
        .with(Transform3D::<f32>::new())
        .build();

    dispatcher.dispatch(&mut world.res);
}