Skip to content

Totobird-Creations/axecs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

axecs

An asynchronous ECS library with ease-of-use in mind, inspired by Bevy ECS

Here's a pretty simple example. It doesn't make good use of async, but it's a good place to start.

use axecs::prelude::*;
use std::time::Duration;
use smol::block_on; // Can also be tokio.

fn main() {
    block_on(async {
        let mut app = App::new();
        app.add_plugin(CycleSchedulerPlugin);
        app.add_systems(Startup, add_people);
        app.add_systems(Update, greet_people);
        app.run().await;
    });
}

#[derive(Component)]
struct PersonName(String);

async fn add_people(
    cmds : Commands
) {
    cmds.spawn((PersonName("John".to_string()),));
    cmds.spawn((PersonName("Jane".to_string()),));
}

async fn greet_people(
    people : Entities<(&PersonName,)>
) {
    for (name,) in &people {
        println!("Hello, {name}!");
    }
}

See the examples.

About

An asynchronous ECS library inspired by Bevy ECS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages