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

Allow dart messages to be easily handled as bevy events #349

Merged
merged 10 commits into from
Jun 30, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions documentation/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ rinf = { version = "0.0.0", features = ["feature-name"] }

- `rt-multi-thread`: Starts a worker thread for each CPU core available on the system within the `tokio` runtime by enabling its `rt-multi-thread` feature. By default, the `tokio` runtime uses only one thread. Enabling this feature allows the `tokio` runtime to utilize all the cores on your computer. This feature does not affect applications on the web platform.
- `show-backtrace`: Prints the full backtrace in the CLI when a panic occurs in debug mode. In general, backtrace is not very helpful when debugging async apps, so consider using [`tracing`](https://crates.io/crates/tracing) for logging purposes. Note that this feature does not affect debugging on the web platform.
- `bevy`: Implements the `Event` trait from `bevy_ecs` for `DartSignal`, allowing Bevy's entity component system to listen for events from Dart.
4 changes: 4 additions & 0 deletions rust_crate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ rust-version = "1.70"
[features]
rt-multi-thread = ["tokio/rt-multi-thread"]
show-backtrace = ["backtrace"]
bevy = ["bevy_ecs"]

[dependencies]
bevy_ecs = { version = "0.13", optional = true }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
os-thread-local = "0.1.3"
Expand Down
1 change: 1 addition & 0 deletions rust_crate/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use super::interface_web::*;
/// Optionally, a custom binary called `binary` can also be included.
/// This type is generic, and the message
/// can be of any type declared in Protobuf.
#[cfg_attr(feature = "bevy", derive(bevy_ecs::event::Event))]
pub struct DartSignal<T> {
/// The message instance of a struct generated by Protobuf.
pub message: T,
Expand Down