2个版本
0.1.1 | 2021年9月19日 |
---|---|
0.1.0 | 2021年9月18日 |
#1715 in 游戏开发
19KB
463 行
Jelly ECS
简单但功能性的ECS。它主要用于游戏开发,但也适用于其他项目。
如果遇到错误,请随意提出问题,甚至可以贡献拉取请求。
示例用法
use jelly_ecs::World;
struct Position(pub f32, pub f32);
struct Health(pub u32);
fn main() -> Result<()> {
let mut world = World::new();
world.register_component::<Position>();
world.register_component::<Health>();
world.create_entity()
.with_component(Position(10.0, 20.0))?
.with_component(Health(100))?;
let query = world
.query()
.with_component::<Position>()?
.with_component::<Health>()?
.run();
let player = &query.1[0];
}
依赖项
~0.4–1MB
~20K SLoC