#events #add #bevy #macro #multiple

bevy-add-events-macro

A macro to add multiple events to a bevy app easily

1 unstable release

0.1.0 Jul 30, 2022

#1675 in Game dev

MIT license

3KB

This is a macro to add events. Given these events:

struct Event1;
struct Event2;
struct Event3;
struct Event4;
struct Event5;

This is the code you have to normally write in bevy

pub fn main() {
    let mut app = App::new();
    app.add_event::<Event1>();
    app.add_event::<Event2>();
    app.add_event::<Event3>();
    app.add_event::<Event4>();
    app.add_event::<Event5>();
   
}

And this is the code you can write with the add_events! macro!

pub fn main() {
    let mut app = App::new();
    add_events!(app, Event1, Event2, Event3, Event4, Event5);
}

No runtime deps