7 releases
new 0.3.0 | Jan 9, 2025 |
---|---|
0.2.0 | Jan 8, 2025 |
0.1.1 | Jan 7, 2025 |
#526 in Game dev
257 downloads per month
21KB
108 lines
bevy-butler
A crate for making Bevy systems more self-documenting.
Note: This crate uses nightly features, and thus requires a nightly compiler.
use bevy::prelude::*;
use bevy_butler::*;
#[system(schedule = Startup)]
fn hello_world()
{
info!("Hello, world!");
}
#[derive(Resource)]
pub struct Hello(pub String);
pub struct MyPlugin;
#[butler_plugin]
impl Plugin for MyPlugin {
fn build(&self, app: &mut App) {
app.insert_resource(Hello("MyPlugin".to_string()));
}
}
#[system(schedule = Update, plugin = MyPlugin)]
fn hello_plugin(name: Res<Hello>)
{
info!("Hello, {}!", name.0);
}
#[system(schedule = Update, plugin = MyPlugin, after = hello_plugin)]
fn goodbye_plugin(name: Res<Hello>)
{
info!("Goodbye, {}!", name.0);
}
fn main() {
App::new()
.add_plugins((BevyButlerPlugin, MyPlugin))
.run();
}
Dependencies
~15–26MB
~364K SLoC