Skip to content

Commit

Permalink
bevy 0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
aevyrie committed Feb 18, 2024
1 parent a300dc5 commit 484f3de
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 37 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# UNRELEASED

- Changed: Updated to Bevy `0.13`.
- Changed: ***BREAKING*** `EntityEvent`s no longer bubble by default.
- If you are using `#[derive(EntityEvent)]`, you will need to add the `#[can_bubble]` attribute to
enable bubbling.
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ categories = ["game-engines", "rendering"]

[dependencies]
bevy_eventlistener_derive = { path = "macros", version = "0.6.2" }
bevy_ecs = "0.12"
bevy_app = "0.12"
bevy_utils = "0.12"
bevy_hierarchy = "0.12"
bevy_ecs = "0.13"
bevy_app = "0.13"
bevy_utils = "0.13"
bevy_hierarchy = "0.13"

[dev-dependencies]
bevy = { version = "0.12", default-features = false, features = [
bevy = { version = "0.13", default-features = false, features = [
"bevy_winit",
"x11",
] }
Expand Down
72 changes: 43 additions & 29 deletions examples/event_listeners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,37 +162,51 @@ fn keyboard_events(
for input in inputs
.read()
.filter(|input| !input.state.is_pressed())
.filter_map(|input| input.key_code)
.map(|input| input.key_code)
{
match input {
KeyCode::Key1 => ev1.send(MyEvent {
target,
message: "Key 1".into(),
}),
KeyCode::Key2 => ev2.send(MyEvent {
target,
message: "Key 2".into(),
}),
KeyCode::Key3 => ev3.send(MyEvent {
target,
message: "Key 3".into(),
}),
KeyCode::Key4 => ev4.send(MyEvent {
target,
message: "Key 4".into(),
}),
KeyCode::Key5 => ev5.send(MyEvent {
target,
message: "Key 5".into(),
}),
KeyCode::Key6 => ev6.send(MyEvent {
target,
message: "Key 6".into(),
}),
KeyCode::Key7 => ev7.send(MyEvent {
target,
message: "Key 7".into(),
}),
KeyCode::Digit1 => {
ev1.send(MyEvent {
target,
message: "Key 1".into(),
});
}
KeyCode::Digit2 => {
ev2.send(MyEvent {
target,
message: "Key 2".into(),
});
}
KeyCode::Digit3 => {
ev3.send(MyEvent {
target,
message: "Key 3".into(),
});
}
KeyCode::Digit4 => {
ev4.send(MyEvent {
target,
message: "Key 4".into(),
});
}
KeyCode::Digit5 => {
ev5.send(MyEvent {
target,
message: "Key 5".into(),
});
}
KeyCode::Digit6 => {
ev6.send(MyEvent {
target,
message: "Key 6".into(),
});
}
KeyCode::Digit7 => {
ev7.send(MyEvent {
target,
message: "Key 7".into(),
});
}
_ => (),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub type ListenerMut<'w, E> = ResMut<'w, ListenerInput<E>>;
/// callback systems.
///
/// ```
/// # use bevy_eventlistener_core::{callbacks::ListenerMut, event_listener::EntityEvent};
/// # use bevy_eventlistener::prelude::{ListenerMut, EntityEvent};
/// # use bevy_ecs::prelude::*;
/// # #[derive(Clone, Event)]
/// # struct MyEvent {
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fn replace_listener() {
app.add_plugins(MinimalPlugins)
.add_plugins(EventListenerPlugin::<Foo>::default())
.add_systems(Update, move |mut event: EventWriter<Foo>| {
event.send(Foo { target: entity })
event.send(Foo { target: entity });
})
.update();

Expand Down Expand Up @@ -151,7 +151,7 @@ fn replace_listener_in_callback() {
app.add_plugins(MinimalPlugins)
.add_plugins(EventListenerPlugin::<Foo>::default())
.add_systems(Update, move |mut event: EventWriter<Foo>| {
event.send(Foo { target: entity })
event.send(Foo { target: entity });
})
.update();

Expand Down

0 comments on commit 484f3de

Please sign in to comment.