mirror of
https://github.com/bevyengine/bevy
synced 2024-11-14 00:47:32 +00:00
694c06f3d0
# Objective Currently the `missing_docs` lint is allowed-by-default and enabled at crate level when their documentations is complete (see #3492). This PR proposes to inverse this logic by making `missing_docs` warn-by-default and mark crates with imcomplete docs allowed. ## Solution Makes `missing_docs` warn at workspace level and allowed at crate level when the docs is imcomplete.
59 lines
1.6 KiB
Rust
59 lines
1.6 KiB
Rust
//! Demonstrates the creation and registration of a custom plugin group.
|
|
//! [`PluginGroup`]s are a way to group sets of plugins that should be registered together.
|
|
|
|
use bevy::{app::PluginGroupBuilder, prelude::*};
|
|
|
|
fn main() {
|
|
App::new()
|
|
.add_plugins((
|
|
// Two PluginGroups that are included with bevy are DefaultPlugins and MinimalPlugins
|
|
DefaultPlugins,
|
|
// Adding a plugin group adds all plugins in the group by default
|
|
HelloWorldPlugins,
|
|
))
|
|
// You can also modify a PluginGroup (such as disabling plugins) like this:
|
|
// .add_plugins(
|
|
// HelloWorldPlugins
|
|
// .build()
|
|
// .disable::<PrintWorldPlugin>()
|
|
// .add_before::<PrintHelloPlugin, _>(
|
|
// bevy::diagnostic::LogDiagnosticsPlugin::default(),
|
|
// ),
|
|
// )
|
|
.run();
|
|
}
|
|
|
|
/// A group of plugins that produce the "hello world" behavior
|
|
pub struct HelloWorldPlugins;
|
|
|
|
impl PluginGroup for HelloWorldPlugins {
|
|
fn build(self) -> PluginGroupBuilder {
|
|
PluginGroupBuilder::start::<Self>()
|
|
.add(PrintHelloPlugin)
|
|
.add(PrintWorldPlugin)
|
|
}
|
|
}
|
|
|
|
struct PrintHelloPlugin;
|
|
|
|
impl Plugin for PrintHelloPlugin {
|
|
fn build(&self, app: &mut App) {
|
|
app.add_systems(Update, print_hello_system);
|
|
}
|
|
}
|
|
|
|
fn print_hello_system() {
|
|
info!("hello");
|
|
}
|
|
|
|
struct PrintWorldPlugin;
|
|
|
|
impl Plugin for PrintWorldPlugin {
|
|
fn build(&self, app: &mut App) {
|
|
app.add_systems(Update, print_world_system);
|
|
}
|
|
}
|
|
|
|
fn print_world_system() {
|
|
info!("world");
|
|
}
|