mirror of
https://github.com/bevyengine/bevy
synced 2024-11-23 05:03:47 +00:00
fe7e31ea76
When `cargo doc -Zunstable-options -Zrustdoc-scrape-examples` (trying to figure out why it doesn't work with bevy), I had the following warnings: ``` warning: unresolved link to `Quad` --> examples/2d/mesh2d.rs:1:66 | 1 | //! Shows how to render a polygonal [`Mesh`], generated from a [`Quad`] primitive, in a 2D scene. | ^^^^ no item named `Quad` in scope | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default warning: `bevy` (example "mesh2d") generated 1 warning warning: unresolved link to `update_weights` --> examples/animation/morph_targets.rs:6:17 | 6 | //! See the [`update_weights`] system for details. | ^^^^^^^^^^^^^^ no item named `update_weights` in scope | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default warning: public documentation for `morph_targets` links to private item `name_morphs` --> examples/animation/morph_targets.rs:7:43 | 7 | //! - How to read morph target names in [`name_morphs`]. | ^^^^^^^^^^^ this item is private | = note: this link will resolve properly if you pass `--document-private-items` = note: `#[warn(rustdoc::private_intra_doc_links)]` on by default warning: public documentation for `morph_targets` links to private item `setup_animations` --> examples/animation/morph_targets.rs:8:48 | 8 | //! - How to play morph target animations in [`setup_animations`]. | ^^^^^^^^^^^^^^^^ this item is private | = note: this link will resolve properly if you pass `--document-private-items` warning: `bevy` (example "morph_targets") generated 3 warnings warning: unresolved link to `Quad` --> examples/2d/mesh2d_vertex_color_texture.rs:1:66 | 1 | //! Shows how to render a polygonal [`Mesh`], generated from a [`Quad`] primitive, in a 2D scene. | ^^^^ no item named `Quad` in scope | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default warning: `bevy` (example "mesh2d_vertex_color_texture") generated 1 warning warning: unresolved link to `UIScale` --> examples/ui/ui_scaling.rs:1:36 | 1 | //! This example illustrates the [`UIScale`] resource from `bevy_ui`. | ^^^^^^^ no item named `UIScale` in scope | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default warning: `bevy` (example "ui_scaling") generated 1 warning warning: unresolved link to `dependencies` --> examples/app/headless.rs:5:6 | 5 | //! [dependencies] | ^^^^^^^^^^^^ no item named `dependencies` in scope | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default warning: `bevy` (example "headless") generated 1 warning warning: unresolved link to `Material2d` --> examples/2d/mesh2d_manual.rs:3:26 | 3 | //! It doesn't use the [`Material2d`] abstraction, but changes the vertex buffer to include verte... | ^^^^^^^^^^ no item named `Material2d` in scope | = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default warning: `bevy` (example "mesh2d_manual") generated 1 warning ```
45 lines
1.1 KiB
Rust
45 lines
1.1 KiB
Rust
//! This example only enables a minimal set of plugins required for bevy to run.
|
|
//! You can also completely remove rendering / windowing Plugin code from bevy
|
|
//! by making your import look like this in your Cargo.toml.
|
|
//!
|
|
//! ```toml
|
|
//! [dependencies]
|
|
//! bevy = { version = "*", default-features = false }
|
|
//! # replace "*" with the most recent version of bevy
|
|
//! ```
|
|
|
|
use bevy::{app::ScheduleRunnerPlugin, prelude::*, utils::Duration};
|
|
|
|
fn main() {
|
|
// This app runs once
|
|
App::new()
|
|
.add_plugins(MinimalPlugins.set(ScheduleRunnerPlugin::run_once()))
|
|
.add_systems(Update, hello_world_system)
|
|
.run();
|
|
|
|
// This app loops forever at 60 fps
|
|
App::new()
|
|
.add_plugins(
|
|
MinimalPlugins.set(ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(
|
|
1.0 / 60.0,
|
|
))),
|
|
)
|
|
.add_systems(Update, counter)
|
|
.run();
|
|
}
|
|
|
|
fn hello_world_system() {
|
|
println!("hello world");
|
|
}
|
|
|
|
fn counter(mut state: Local<CounterState>) {
|
|
if state.count % 60 == 0 {
|
|
println!("{}", state.count);
|
|
}
|
|
state.count += 1;
|
|
}
|
|
|
|
#[derive(Default)]
|
|
struct CounterState {
|
|
count: u32,
|
|
}
|