Crate magma_ecs

Source
Expand description

This crate provides the Entity-Component-System of the Magma3D-Engine.

The crate provides a World struct with Resources and Entities. An entity is just an index into the component storage. A resource is like a global component, independent of the Entities.

Example for creating and setting up a World:

use magma_ecs::World;

let mut world = World::new();

// Register a component type.
// This can be any type that implements Any + Send + Sync.
world.register_component::<u32>();

// add a resource
world.add_resource(10_u32);

// create an entity with registered component
world.create_entity((20_u32,)).unwrap();

Modules§

entities
Provides the Entities struct as well as query and query_entity modules.
error
Error types Error types
resources
Provides the Resources struct.
systems
Provides the Systems struct, from which a Dispatcher can be created.

Structs§

World
The World struct holds all the data of our world.