Crate xuko_ecs

Crate xuko_ecs 

Source
Expand description

Entity Component System

§Examples

use xuko_ecs::{World, Entity};

let mut world = World::new();

struct Monster;
struct Position(i32, i32);
struct Health(i32);

{
    let entity = world.spawn();
    let components = world.get_entity_mut(entity).unwrap();

    // Anything can be used as a component, without any trait implementation.
    // As long as the type is `Send + Sync + 'static`
    components.add(Monster);
    components.add(Position(43, 59));
    components.add(Health(5));
}

{
    let entity = world.spawn();
    let components = world.get_entity_mut(entity).unwrap();
    components.add(Monster);
    components.add(Position(55, 30));
    components.add(Health(3));
}

Re-exports§

pub use component::Entity;
pub use component::EntityData;
pub use query::Query;
pub use query::QueryFilter;
pub use resource::Resource;
pub use world::World;

Modules§

component
Items related to components
events
Items related to events
prelude
Contains re-exports for the most used parts of the library
query
World Queries
resource
Global Resources
schedule
Scheduling System
world
The World

Macros§

component_id
Get the ComponentId for type

Structs§

ComponentId
Component id, used as index to EntityData