5 releases

0.6.0 Apr 30, 2025
0.5.3 Mar 17, 2025
0.5.2 Mar 17, 2025
0.5.1 Mar 17, 2025
0.5.0 Mar 14, 2025

#2094 in Game dev

Download history 67/week @ 2025-03-10 284/week @ 2025-03-17 36/week @ 2025-03-24 5/week @ 2025-03-31 13/week @ 2025-04-07 29/week @ 2025-04-14 7/week @ 2025-04-21 130/week @ 2025-04-28 28/week @ 2025-05-05 35/week @ 2025-05-12 11/week @ 2025-05-19 2/week @ 2025-05-26

51 downloads per month
Used in 5 crates (2 directly)

MIT/Apache

310KB
5.5K SLoC

Gloss Hecs

A small wrapper around hecs with convenience functions for easy use with gloss.


lib.rs:

A handy ECS

hecs provides a high-performance, minimalist entity-component-system (ECS) world. It is a library, not a framework. In place of an explicit "System" abstraction, a World's entities are easily queried from regular code. Organize your application however you like!

In order of importance, hecs pursues:

  • fast traversals
  • a simple interface
  • a small dependency closure
  • exclusion of externally-implementable functionality
let mut world = World::new();
// Nearly any type can be used as a component with zero boilerplate
let a = world.spawn((123, true, "abc"));
let b = world.spawn((42, false));
// Systems can be simple for loops
for (id, (mut number, &flag)) in world.query_mut::<(&mut i32, &bool)>() {
    if flag {
        *number *= 2;
    }
}
// Random access is simple and safe
assert_eq!(*world.get::<&i32>(a).unwrap(), 246);
assert_eq!(*world.get::<&i32>(b).unwrap(), 42);

Dependencies

~46–79MB
~1.5M SLoC