#specs #transform #2d #3d

specs_transform

transform 2d and 3d component for specs

22 releases

Uses old Rust 2015

0.5.0 Jul 5, 2019
0.4.5 Dec 1, 2018
0.4.4 Nov 24, 2018
0.4.3 Jul 7, 2018
0.3.0 Nov 26, 2017

#5 in #specs

Download history 62/week @ 2023-10-29 22/week @ 2023-11-05 46/week @ 2023-11-12 18/week @ 2023-11-19 85/week @ 2023-11-26 56/week @ 2023-12-03 35/week @ 2023-12-10 17/week @ 2023-12-17 62/week @ 2023-12-24 8/week @ 2023-12-31 19/week @ 2024-01-07 38/week @ 2024-01-14 43/week @ 2024-01-21 52/week @ 2024-01-28 18/week @ 2024-02-04 88/week @ 2024-02-11

209 downloads per month
Used in 3 crates

MIT license

27KB
689 lines

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::Bundler;
use specs_transform::{TransformBundle, Parent, Transform3D, , Transform2D};


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

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

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

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

    let _grandchild = world.create_entity()
        .with(Parent::new(child))
        .with(Transform3D::<f32>::default())
        .build();

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

Dependencies

~6.5MB
~123K SLoC