Skip to content

Commit

Permalink
bevy 0.13 (#20)
Browse files Browse the repository at this point in the history
* bevy 0.13

* Bump version

* fix merge

* bump macro crate
  • Loading branch information
aevyrie authored Feb 18, 2024
1 parent a300dc5 commit 22f43ec
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 90 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# UNRELEASED
# 0.7.0

- 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.
- If you are manually implementing the trait, you will need to override the default `can_bubble`
trait method and return true.
trait method and return `true`.
- Changed: dissolved the `bevy_eventlistener_core` crate.
- Changed: `commands_mut`, `target_commands_mut`, `target_component_mut`, `listener_commands_mut`,
and `listener_component_mut` have been changed to provide a mutable reference to
Expand Down
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resolver = "2"

[package]
name = "bevy_eventlistener"
version = "0.6.2"
version = "0.7.0"
edition = "2021"
description = "Event listeners and callbacks for bevy"
license = "MIT OR Apache-2.0"
Expand All @@ -15,14 +15,14 @@ keywords = ["gamedev", "bevy", "eventlistener", "callbacks"]
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_eventlistener_derive = { path = "macros", version = "0.7.0" }
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
48 changes: 0 additions & 48 deletions crates/macros/src/lib.rs

This file was deleted.

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 macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_eventlistener_derive"
version = "0.6.2"
version = "0.7.0"
edition = "2021"
description = "Event listeners and callbacks for bevy"
license = "MIT OR Apache-2.0"
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 22f43ec

Please sign in to comment.