Crates.io | planck_ecs |
lib.rs | planck_ecs |
version | 1.2.1 |
source | src |
created_at | 2021-03-08 17:20:36.834581 |
updated_at | 2021-06-21 12:47:26.963535 |
description | A tiny but very powerful ECS framework. |
homepage | |
repository | https://github.com/jojolepro/planck_ecs/ |
max_upload_size | |
id | 365780 |
size | 182,115 |
The full ECS (Entity-Component-System) library.
Support an Open Source Developer! :hearts:
Composed of two smaller libraries:
System
part of the ECS.Entity-Component
part of the ECS.Read the documentation.
unsafe
in total. (compared to hundreds in mainstream ECS libraries!)Add the following to you Cargo.toml file:
planck_ecs = "*"
Use it like so:
use planck_ecs::*;
fn main() {
#[derive(Default)]
pub struct A;
let mut world = World::default();
let sys = (|comps: &mut Components<A>, entities: &mut Entities| {
let entity = entities.create();
comps.insert(entity, A);
Ok(())
}).system();
let mut dispatch = DispatcherBuilder::new().add_system(sys).build(&mut world);
dispatch.run_seq(&world).unwrap();
dispatch.run_seq(&world).unwrap();
dispatch.run_seq(&world).unwrap();
assert!(world.get::<Components<A>>().is_ok());
}
For more examples, see the two following repositories' example folders and documentation: