1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! # ponko_ecs
//!
//! The entity-component-system behind Crabby Engine, built for simulations
//! with millions of entities.
//!
//! - **Entities** are cheap handles ([`Entity`]).
//! - **Components** are plain Rust types, with no derive needed. Anything
//! `Send + Sync + 'static` works.
//! - **Queries** loop over every entity that has a set of components, as fast
//! as a hand-written loop over arrays.
//! - **Resources** are global values stored in the world.
//! - **Commands** record changes to apply after a query finishes.
//!
//! ```
//! use ponko_ecs::*;
//!
//! struct Pos(f32, f32);
//! struct Vel(f32, f32);
//! struct Gravity(f32);
//!
//! let mut world = World::new();
//! world.insert_resource(Gravity(-9.8));
//! for i in 0..1000 {
//! world.spawn((Pos(i as f32, 0.0), Vel(0.0, 0.0)));
//! }
//!
//! let g = world.resource::<Gravity>().0;
//! world.query::<&mut Vel>().for_each(|v| v.1 += g);
//! world.query::<(&mut Pos, &Vel)>().for_each(|(p, v)| {
//! p.0 += v.0;
//! p.1 += v.1;
//! });
//! ```
//!
//! Under the hood every component, Rust or not, is a runtime-registered column
//! (name, size, alignment, drop). Rust types are registered on first use;
//! C/C++ code uses [`World::register_component`] and [`World::for_each_chunk`].
pub use ;
pub use Commands;
pub use Entity;
pub use ;
pub use ;
pub use ;