5 releases
0.1.0-alpha.5 | Jul 9, 2024 |
---|---|
0.1.0-alpha.3 | Dec 18, 2023 |
0.1.0-alpha.2 | Dec 5, 2023 |
0.1.0-alpha.1 | Nov 30, 2023 |
#471 in Game dev
53 downloads per month
Used in 5 crates
(via magma_app)
27KB
601 lines
Magma-ECS
Magma-ECS is the Entity-component-system for the Magma3D engine.
Features
- Simple and Lightweight
- Update funktion for systems
Allow for easy execution of the systems
- Parallel
All code is automatically parallelized
Disclaimer
This is still in developement and not production ready.
lib.rs
:
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, independant from the Entities
.
Example for creating and setting up a World
:
use magma_ecs::World;
let world = World::new();
// register a component type
world.register_component::<u32>();
// add a resource
world.add_resource(10_u32);
// create entity with registered component.
// It is recommended to free read/write locks as quickly as possible. Use scopes to do that.
{
let mut entities = world.entities_write();
entities.create_entity().with_component(20_u32).unwrap();
}
Dependencies
~1.5MB
~25K SLoC