
This updates the `pipelined-rendering` branch to use the latest `bevy_ecs` from `main`. This accomplishes a couple of goals: 1. prepares for upcoming `custom-shaders` branch changes, which were what drove many of the recent bevy_ecs changes on `main` 2. prepares for the soon-to-happen merge of `pipelined-rendering` into `main`. By including bevy_ecs changes now, we make that merge simpler / easier to review. I split this up into 3 commits: 1. **add upstream bevy_ecs**: please don't bother reviewing this content. it has already received thorough review on `main` and is a literal copy/paste of the relevant folders (the old folders were deleted so the directories are literally exactly the same as `main`). 2. **support manual buffer application in stages**: this is used to enable the Extract step. we've already reviewed this once on the `pipelined-rendering` branch, but its worth looking at one more time in the new context of (1). 3. **support manual archetype updates in QueryState**: same situation as (2).
45 lines
1.4 KiB
Rust
45 lines
1.4 KiB
Rust
use bevy::{prelude::*, utils::Duration};
|
|
|
|
/// Plugins are the foundation of Bevy. They are scoped sets of components, resources, and systems
|
|
/// that provide a specific piece of functionality (generally the smaller the scope, the better).
|
|
/// This example illustrates how to create a simple plugin that prints out a message.
|
|
fn main() {
|
|
App::new()
|
|
.add_plugins(DefaultPlugins)
|
|
// plugins are registered as part of the "app building" process
|
|
.add_plugin(PrintMessagePlugin {
|
|
wait_duration: Duration::from_secs(1),
|
|
message: "This is an example plugin".to_string(),
|
|
})
|
|
.run();
|
|
}
|
|
|
|
// This "print message plugin" prints a `message` every `wait_duration`
|
|
pub struct PrintMessagePlugin {
|
|
// Put your plugin configuration here
|
|
wait_duration: Duration,
|
|
message: String,
|
|
}
|
|
|
|
impl Plugin for PrintMessagePlugin {
|
|
// this is where we set up our plugin
|
|
fn build(&self, app: &mut App) {
|
|
let state = PrintMessageState {
|
|
message: self.message.clone(),
|
|
timer: Timer::new(self.wait_duration, true),
|
|
};
|
|
app.insert_resource(state).add_system(print_message_system);
|
|
}
|
|
}
|
|
|
|
struct PrintMessageState {
|
|
message: String,
|
|
timer: Timer,
|
|
}
|
|
|
|
fn print_message_system(mut state: ResMut<PrintMessageState>, time: Res<Time>) {
|
|
if state.timer.tick(time.delta()).finished() {
|
|
info!("{}", state.message);
|
|
}
|
|
}
|