Crates.io | kudo |
lib.rs | kudo |
version | 0.4.0 |
source | src |
created_at | 2020-10-15 07:08:30.532821 |
updated_at | 2020-10-24 07:46:03.691672 |
description | A minimalist Entity Component System. (Work in Progress) |
homepage | |
repository | https://github.com/kettle11/kudo |
max_upload_size | |
id | 299912 |
size | 54,799 |
An Entity Component System for Rust. Fast, easy, and predictable.
unsafe
struct Health(f32);
struct Name(String);
struct CreepySnakeHair(u32);
let mut world = World::new();
// Create entities with components.
world.spawn((Name("Perseus".to_string()), Health(50.)));
world.spawn((
Name("Medusa".to_string()),
Health(100.),
CreepySnakeHair(300),
));
// Find every entity with a `Name` and a `Health` component.
let mut query = world.query::<(&Name, &Health)>().unwrap();
// Iterate through all entities with those components.
for (name, health) in query.iter() {
println!("{}'s health is: {:?}", name.0, health.0);
}
Kudo
was inspired by the library hecs
. If you need a more feature-rich ECS, give hecs
a try!