Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump bevy to 0.12 #11

Merged
merged 3 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 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.5.1"
version = "0.6.0"
edition = "2021"
description = "Event listeners and callbacks for bevy"
license = "MIT OR Apache-2.0"
Expand All @@ -15,11 +15,11 @@ keywords = ["gamedev", "bevy", "eventlistener", "callbacks"]
categories = ["game-engines", "rendering"]

[dependencies]
bevy_eventlistener_core = { path = "crates/bevy_eventlistener_core", version = "0.5.1" }
bevy_eventlistener_core = { path = "crates/bevy_eventlistener_core", version = "0.6.0" }
bevy_eventlistener_derive = { path = "crates/bevy_eventlistener_derive", version = "0.5.1" }

[dev-dependencies]
bevy = { version = "0.11", default-features = false, features = [
bevy = { version = "0.12", default-features = false, features = [
"bevy_winit",
"x11",
] }
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ The blue line can be read as "how long does it take all of these events to bubbl

The runtime cost of each event decreases as the total number of events increase, this is because graph construction is a fixed cost for each type of event. Adding more events simply amortizes that cost across more events. At 50 events the runtime cost is only ~500ns/event, and about 25us total. To reiterate, this is using an entity hierarchy similar to the most complex websites I could find.

# Bevy version support

|bevy|bevy\_eventlistener|
|----|---|
|0.12|0.6|
|0.11|0.5|

# License

All code in this repository is dual-licensed under either:
Expand All @@ -83,4 +90,3 @@ at your option. This means you can select the license you prefer.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the
work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.

10 changes: 5 additions & 5 deletions crates/bevy_eventlistener_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bevy_eventlistener_core"
version = "0.5.1"
version = "0.6.0"
edition = "2021"
description = "Event listeners and callbacks for bevy"
license = "MIT OR Apache-2.0"
Expand All @@ -9,10 +9,10 @@ keywords = ["gamedev", "bevy", "eventlistener", "callbacks"]
categories = ["game-engines", "rendering"]

[dependencies]
bevy_ecs = "0.11"
bevy_app = "0.11"
bevy_utils = "0.11"
bevy_hierarchy = "0.11"
bevy_ecs = "0.12"
bevy_app = "0.12"
bevy_utils = "0.12"
bevy_hierarchy = "0.12"

[features]
default = ["trace"]
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_eventlistener_core/src/event_dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl<E: EntityEvent> EventDispatcher<E> {
dead_branch_nodes.clear();
target_cache.clear();

for event in events.iter() {
for event in events.read() {
// if the target belongs to a dead branch, exit early.
if dead_branch_nodes.contains(&event.target()) {
continue;
Expand Down
4 changes: 2 additions & 2 deletions examples/event_listeners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl From<ListenerInput<MyEvent<7>>> for DoSomethingComplex {
/// Unlike the [`some_simple_system`], this one can run in parallel with other systems because it is
/// scheduled.
fn some_complex_system(mut events: EventReader<DoSomethingComplex>) {
for event in events.iter() {
for event in events.read() {
info!("Doing complex things with data: {}", event.important_data)
}
}
Expand All @@ -159,7 +159,7 @@ fn keyboard_events(
) {
let target = target.0;
for input in inputs
.iter()
.read()
.filter(|input| !input.state.is_pressed())
.filter_map(|input| input.key_code)
{
Expand Down