From 3d0945981300f0fac72cbc27b5a27082e78c9bd0 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Sun, 9 Aug 2020 16:13:04 -0700 Subject: [PATCH] add more doc comments and clean up some public exports --- crates/bevy_app/src/app.rs | 20 ++++++ crates/bevy_app/src/app_builder.rs | 5 +- crates/bevy_app/src/event.rs | 1 + crates/bevy_app/src/lib.rs | 5 +- crates/bevy_app/src/plugin.rs | 6 +- crates/bevy_app/src/schedule_runner.rs | 2 + crates/bevy_asset/src/asset_server.rs | 12 +++- crates/bevy_asset/src/assets.rs | 3 + crates/bevy_asset/src/filesystem_watcher.rs | 2 +- crates/bevy_asset/src/handle.rs | 13 +++- crates/bevy_asset/src/lib.rs | 7 +- crates/bevy_asset/src/load_request.rs | 4 +- crates/bevy_asset/src/loader.rs | 5 ++ crates/bevy_audio/src/audio_output.rs | 4 +- crates/bevy_audio/src/audio_source.rs | 2 + crates/bevy_audio/src/lib.rs | 1 + crates/bevy_core/src/bytes.rs | 9 +++ crates/bevy_core/src/float_ord.rs | 4 +- crates/bevy_core/src/label.rs | 4 +- crates/bevy_core/src/lib.rs | 4 +- crates/bevy_core/src/time/time.rs | 3 +- crates/bevy_core/src/time/timer.rs | 11 +-- crates/bevy_derive/src/lib.rs | 12 +++- crates/bevy_diagnostic/src/diagnostic.rs | 5 ++ .../src/frame_time_diagnostics_plugin.rs | 1 + crates/bevy_diagnostic/src/lib.rs | 3 +- .../src/print_diagnostics_plugin.rs | 2 + crates/bevy_diagnostic/src/system_profiler.rs | 1 + .../bevy_ecs/src/resource/resource_query.rs | 68 ++++++++++--------- crates/bevy_ecs/src/resource/resources.rs | 6 +- .../src/schedule/parallel_executor.rs | 8 +++ crates/bevy_ecs/src/schedule/schedule.rs | 3 + crates/bevy_ecs/src/system/commands.rs | 15 ++-- crates/bevy_ecs/src/system/into_system.rs | 7 +- crates/bevy_ecs/src/system/profiler.rs | 3 + crates/bevy_ecs/src/system/query.rs | 2 + crates/bevy_ecs/src/system/system.rs | 6 +- crates/bevy_ecs/src/world/world_builder.rs | 2 + crates/bevy_gltf/src/lib.rs | 1 + crates/bevy_gltf/src/loader.rs | 4 ++ crates/bevy_input/src/input.rs | 1 + crates/bevy_input/src/keyboard.rs | 9 ++- crates/bevy_input/src/lib.rs | 7 +- crates/bevy_input/src/mouse.rs | 9 ++- crates/bevy_input/src/system.rs | 2 + crates/bevy_math/src/face_toward.rs | 2 + crates/bevy_math/src/geometry.rs | 2 + crates/bevy_math/src/perspective.rs | 2 + crates/bevy_pbr/src/entity.rs | 7 +- crates/bevy_pbr/src/lib.rs | 17 +++-- crates/bevy_pbr/src/light.rs | 3 +- crates/bevy_pbr/src/material.rs | 1 + crates/bevy_pbr/src/nodes/mod.rs | 3 - crates/bevy_pbr/src/pipelines/mod.rs | 3 - crates/bevy_pbr/src/render_graph.rs | 53 --------------- .../forward_pipeline}/forward.frag | 0 .../forward_pipeline}/forward.vert | 0 .../forward_pipeline}/mod.rs | 3 +- .../{nodes => render_graph}/lights_node.rs | 4 +- crates/bevy_pbr/src/render_graph/mod.rs | 50 ++++++++++++++ crates/bevy_render/src/color.rs | 2 + crates/bevy_render/src/draw.rs | 2 + crates/bevy_render/src/entity.rs | 8 +-- crates/bevy_render/src/lib.rs | 13 +++- crates/bevy_render/src/render_graph/base.rs | 6 +- crates/bevy_render/src/shader/shader.rs | 8 ++- crates/bevy_render/src/shader/shader_defs.rs | 6 ++ .../bevy_render/src/shader/shader_reflect.rs | 1 + .../src/texture/hdr_texture_loader.rs | 1 + .../src/texture/sampler_descriptor.rs | 3 + .../src/texture/texture_descriptor.rs | 1 + .../src/texture/texture_dimension.rs | 7 ++ crates/bevy_sprite/src/entity.rs | 3 +- examples/window/multiple_windows.rs | 8 ++- 74 files changed, 360 insertions(+), 163 deletions(-) delete mode 100644 crates/bevy_pbr/src/nodes/mod.rs delete mode 100644 crates/bevy_pbr/src/pipelines/mod.rs delete mode 100644 crates/bevy_pbr/src/render_graph.rs rename crates/bevy_pbr/src/{pipelines/forward => render_graph/forward_pipeline}/forward.frag (100%) rename crates/bevy_pbr/src/{pipelines/forward => render_graph/forward_pipeline}/forward.vert (100%) rename crates/bevy_pbr/src/{pipelines/forward => render_graph/forward_pipeline}/mod.rs (95%) rename crates/bevy_pbr/src/{nodes => render_graph}/lights_node.rs (97%) create mode 100644 crates/bevy_pbr/src/render_graph/mod.rs diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs index ca42f6d4fd..f20cb4fdff 100644 --- a/crates/bevy_app/src/app.rs +++ b/crates/bevy_app/src/app.rs @@ -1,6 +1,26 @@ use crate::app_builder::AppBuilder; use bevy_ecs::{ParallelExecutor, Resources, Schedule, World}; +/// Containers of app logic and data +/// +/// App store the ECS World, Resources, Schedule, and Executor. They also store the "run" function of the App, which +/// by default executes the App schedule once. Apps are constructed using the builder pattern. +/// +/// ## Example +/// Here is a simple "Hello World" Bevy app: +/// ``` +///use bevy::prelude::*; +/// +///fn main() { +/// App::build() +/// .add_system(hello_world_system.system()) +/// .run(); +///} +/// +///fn hello_world_system() { +/// println!("hello world"); +///} +/// ``` pub struct App { pub world: World, pub resources: Resources, diff --git a/crates/bevy_app/src/app_builder.rs b/crates/bevy_app/src/app_builder.rs index 3a3965b449..9873f9921d 100644 --- a/crates/bevy_app/src/app_builder.rs +++ b/crates/bevy_app/src/app_builder.rs @@ -1,11 +1,12 @@ use crate::{ app::{App, AppExit}, event::Events, - plugin::{load_plugin, Plugin}, + plugin::{dynamically_load_plugin, Plugin}, stage, startup_stage, }; use bevy_ecs::{FromResources, IntoQuerySystem, Resources, System, World}; +/// Configure [App]s using the builder pattern pub struct AppBuilder { pub app: App, } @@ -220,7 +221,7 @@ impl AppBuilder { } pub fn load_plugin(&mut self, path: &str) -> &mut Self { - let (_lib, plugin) = load_plugin(path); + let (_lib, plugin) = dynamically_load_plugin(path); log::debug!("loaded plugin: {}", plugin.name()); plugin.build(self); self diff --git a/crates/bevy_app/src/event.rs b/crates/bevy_app/src/event.rs index fc9783789a..bb197c6966 100644 --- a/crates/bevy_app/src/event.rs +++ b/crates/bevy_app/src/event.rs @@ -82,6 +82,7 @@ fn map_instance_event(event_instance: &EventInstance) -> &T { &event_instance.event } +/// Reads events of type `T` in order and tracks which events have already been read. pub struct EventReader { last_event_count: usize, _marker: PhantomData, diff --git a/crates/bevy_app/src/lib.rs b/crates/bevy_app/src/lib.rs index 871b172c45..d2e241616b 100644 --- a/crates/bevy_app/src/lib.rs +++ b/crates/bevy_app/src/lib.rs @@ -1,11 +1,13 @@ +/// The names of the default App stages pub mod stage; +/// The names of the default App startup stages +pub mod startup_stage; mod app; mod app_builder; mod event; mod plugin; mod schedule_runner; -mod startup_stage; pub use app::*; pub use app_builder::*; @@ -13,7 +15,6 @@ pub use bevy_derive::DynamicPlugin; pub use event::*; pub use plugin::*; pub use schedule_runner::*; -pub use startup_stage::*; pub mod prelude { pub use crate::{ diff --git a/crates/bevy_app/src/plugin.rs b/crates/bevy_app/src/plugin.rs index cee7effbd0..628ac5f8d2 100644 --- a/crates/bevy_app/src/plugin.rs +++ b/crates/bevy_app/src/plugin.rs @@ -2,6 +2,9 @@ use crate::AppBuilder; use libloading::{Library, Symbol}; use std::any::Any; +/// A collection of Bevy App logic and configuration +/// +/// Plugins use [AppBuilder] to configure an [App](crate::App). When an [App](crate::App) registers a plugin, the plugin's [Plugin::build] function is run. pub trait Plugin: Any + Send + Sync { fn build(&self, app: &mut AppBuilder); fn name(&self) -> &str { @@ -11,7 +14,8 @@ pub trait Plugin: Any + Send + Sync { pub type CreatePlugin = unsafe fn() -> *mut dyn Plugin; -pub fn load_plugin(path: &str) -> (Library, Box) { +/// Dynamically links a plugin a the given path. The plugin must export the [CreatePlugin] function. +pub fn dynamically_load_plugin(path: &str) -> (Library, Box) { let lib = Library::new(path).unwrap(); unsafe { diff --git a/crates/bevy_app/src/schedule_runner.rs b/crates/bevy_app/src/schedule_runner.rs index d9f4569067..605eb87139 100644 --- a/crates/bevy_app/src/schedule_runner.rs +++ b/crates/bevy_app/src/schedule_runner.rs @@ -6,6 +6,7 @@ use crate::{ }; use std::{thread, time::Duration}; +/// Determines the method used to run an [App]'s `Schedule` #[derive(Copy, Clone, Debug)] pub enum RunMode { Loop { wait: Option }, @@ -18,6 +19,7 @@ impl Default for RunMode { } } +/// Configures an App to run its [Schedule](bevy_ecs::Schedule) according to a given [RunMode] #[derive(Default)] pub struct ScheduleRunnerPlugin { pub run_mode: RunMode, diff --git a/crates/bevy_asset/src/asset_server.rs b/crates/bevy_asset/src/asset_server.rs index b98fb985c6..1825a1c1a8 100644 --- a/crates/bevy_asset/src/asset_server.rs +++ b/crates/bevy_asset/src/asset_server.rs @@ -14,7 +14,10 @@ use std::{ }; use thiserror::Error; +/// The type used for asset versioning pub type AssetVersion = usize; + +/// Errors that occur while loading assets with an AssetServer #[derive(Error, Debug)] pub enum AssetServerError { #[error("Asset folder path is not a directory.")] @@ -39,13 +42,15 @@ struct LoaderThread { requests: Arc>>, } +/// Info about a specific asset, such as its path and its current load state #[derive(Clone, Debug)] pub struct AssetInfo { - handle_id: HandleId, - path: PathBuf, - load_state: LoadState, + pub handle_id: HandleId, + pub path: PathBuf, + pub load_state: LoadState, } +/// The load state of an asset #[derive(Clone, Debug, Eq, PartialEq)] pub enum LoadState { Loading(AssetVersion), @@ -63,6 +68,7 @@ impl LoadState { } } +/// Loads assets from the filesystem on background threads pub struct AssetServer { asset_folders: RwLock>, loader_threads: RwLock>, diff --git a/crates/bevy_asset/src/assets.rs b/crates/bevy_asset/src/assets.rs index beb21d480c..201614f862 100644 --- a/crates/bevy_asset/src/assets.rs +++ b/crates/bevy_asset/src/assets.rs @@ -7,12 +7,14 @@ use bevy_ecs::{FromResources, IntoQuerySystem, ResMut, Resource}; use bevy_type_registry::RegisterType; use std::collections::HashMap; +/// Events that happen on assets of type `T` pub enum AssetEvent { Created { handle: Handle }, Modified { handle: Handle }, Removed { handle: Handle }, } +/// Stores Assets of a given type and tracks changes to them. pub struct Assets { assets: HashMap, T>, events: Events>, @@ -108,6 +110,7 @@ impl Assets { } } +/// [AppBuilder] extension methods for adding new asset types pub trait AddAsset { fn add_asset(&mut self) -> &mut Self where diff --git a/crates/bevy_asset/src/filesystem_watcher.rs b/crates/bevy_asset/src/filesystem_watcher.rs index 386d49e370..2b05cf85e3 100644 --- a/crates/bevy_asset/src/filesystem_watcher.rs +++ b/crates/bevy_asset/src/filesystem_watcher.rs @@ -2,7 +2,7 @@ use crossbeam_channel::Receiver; use notify::{Event, RecommendedWatcher, RecursiveMode, Result, Watcher}; use std::path::Path; -/// Watches for changes to assets on the filesystem and informs the `AssetServer` to reload them +/// Watches for changes to assets on the filesystem. This is used by the `AssetServer` to reload them pub struct FilesystemWatcher { pub watcher: RecommendedWatcher, pub receiver: Receiver>, diff --git a/crates/bevy_asset/src/handle.rs b/crates/bevy_asset/src/handle.rs index 14d2c77ab2..b60604d30e 100644 --- a/crates/bevy_asset/src/handle.rs +++ b/crates/bevy_asset/src/handle.rs @@ -8,10 +8,13 @@ use serde::{Deserialize, Serialize}; use std::{any::TypeId, marker::PhantomData}; use uuid::Uuid; +/// The ID of the "default" asset +pub(crate) const DEFAULT_HANDLE_ID: HandleId = + HandleId(Uuid::from_u128(240940089166493627844978703213080810552)); + +/// A unique id that corresponds to a specific asset in the [Assets](crate::Assets) collection. #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize, Property)] pub struct HandleId(pub Uuid); -pub const DEFAULT_HANDLE_ID: HandleId = - HandleId(Uuid::from_u128(240940089166493627844978703213080810552)); impl HandleId { pub fn new() -> HandleId { @@ -19,6 +22,9 @@ impl HandleId { } } +/// A handle into a specific Asset of type `T` +/// +/// Handles contain a unique id that corresponds to a specific asset in the [Assets](crate::Assets) collection. #[derive(Properties)] pub struct Handle where @@ -156,6 +162,9 @@ impl Copy for Handle {} unsafe impl Send for Handle {} unsafe impl Sync for Handle {} +/// A non-generic version of [Handle] +/// +/// This allows handles to be mingled in a cross asset context. For example, storing `Handle` and `Handle` in the same `HashSet`. #[derive(Hash, Copy, Clone, Eq, PartialEq, Debug)] pub struct HandleUntyped { pub id: HandleId, diff --git a/crates/bevy_asset/src/lib.rs b/crates/bevy_asset/src/lib.rs index fe742af678..8dd3635bcf 100644 --- a/crates/bevy_asset/src/lib.rs +++ b/crates/bevy_asset/src/lib.rs @@ -1,7 +1,7 @@ +#[cfg(feature = "filesystem_watcher")] +mod filesystem_watcher; mod asset_server; mod assets; -#[cfg(feature = "filesystem_watcher")] -pub mod filesystem_watcher; mod handle; mod load_request; mod loader; @@ -12,6 +12,7 @@ pub use handle::*; pub use load_request::*; pub use loader::*; +/// The names of asset stages in an App Schedule pub mod stage { pub const LOAD_ASSETS: &str = "load_assets"; pub const ASSET_EVENTS: &str = "asset_events"; @@ -25,6 +26,8 @@ use bevy_app::{prelude::Plugin, AppBuilder}; use bevy_ecs::IntoQuerySystem; use bevy_type_registry::RegisterType; +/// Adds support for Assets to an App. Assets are typed collections with change tracking, which are added as App Resources. +/// Examples of assets: textures, sounds, 3d models, maps, scenes #[derive(Default)] pub struct AssetPlugin; diff --git a/crates/bevy_asset/src/load_request.rs b/crates/bevy_asset/src/load_request.rs index 2054654086..3da04fd952 100644 --- a/crates/bevy_asset/src/load_request.rs +++ b/crates/bevy_asset/src/load_request.rs @@ -5,6 +5,7 @@ use fs::File; use io::Read; use std::{fs, io, path::PathBuf}; +/// A request from an [AssetServer](crate::AssetServer) to load an asset. #[derive(Debug)] pub struct LoadRequest { pub path: PathBuf, @@ -13,12 +14,13 @@ pub struct LoadRequest { pub version: AssetVersion, } +/// Handles load requests from an AssetServer pub trait AssetLoadRequestHandler: Send + Sync + 'static { fn handle_request(&self, load_request: &LoadRequest); fn extensions(&self) -> &[&str]; } -pub struct ChannelAssetHandler +pub(crate) struct ChannelAssetHandler where TLoader: AssetLoader, TAsset: 'static, diff --git a/crates/bevy_asset/src/loader.rs b/crates/bevy_asset/src/loader.rs index 49cb26b90e..6b4a0c1533 100644 --- a/crates/bevy_asset/src/loader.rs +++ b/crates/bevy_asset/src/loader.rs @@ -10,6 +10,7 @@ use std::{ }; use thiserror::Error; +/// Errors that occur while loading assets #[derive(Error, Debug)] pub enum AssetLoadError { #[error("Encountered an io error while loading asset.")] @@ -18,6 +19,7 @@ pub enum AssetLoadError { LoaderError(#[from] anyhow::Error), } +/// A loader for a given asset of type `T` pub trait AssetLoader: Send + Sync + 'static { fn from_bytes(&self, asset_path: &Path, bytes: Vec) -> Result; fn extensions(&self) -> &[&str]; @@ -30,6 +32,7 @@ pub trait AssetLoader: Send + Sync + 'static { } } +/// The result of loading an asset of type `T` pub struct AssetResult { pub result: Result, pub handle: Handle, @@ -37,6 +40,7 @@ pub struct AssetResult { pub version: AssetVersion, } +/// A channel to send and receive [AssetResult]s pub struct AssetChannel { pub sender: Sender>, pub receiver: Receiver>, @@ -49,6 +53,7 @@ impl AssetChannel { } } +/// Reads [AssetResult]s from an [AssetChannel] and updates the [Assets] collection and [LoadState] accordingly pub fn update_asset_storage_system( asset_channel: Res>, asset_server: Res, diff --git a/crates/bevy_audio/src/audio_output.rs b/crates/bevy_audio/src/audio_output.rs index a97f5cc09a..5b578fbfeb 100644 --- a/crates/bevy_audio/src/audio_output.rs +++ b/crates/bevy_audio/src/audio_output.rs @@ -4,6 +4,7 @@ use bevy_ecs::Res; use rodio::{Decoder, Device, Sink}; use std::{collections::VecDeque, io::Cursor, sync::RwLock}; +/// Used to play audio on the current "audio device" pub struct AudioOutput { device: Device, queue: RwLock>>, @@ -46,7 +47,8 @@ impl AudioOutput { } } -pub fn play_queued_audio_system( +/// Plays audio currently queued in the [AudioOutput] resource +pub(crate) fn play_queued_audio_system( audio_sources: Res>, audio_output: Res, ) { diff --git a/crates/bevy_audio/src/audio_source.rs b/crates/bevy_audio/src/audio_source.rs index b3d4a20d03..94b43b91bf 100644 --- a/crates/bevy_audio/src/audio_source.rs +++ b/crates/bevy_audio/src/audio_source.rs @@ -2,6 +2,7 @@ use anyhow::Result; use bevy_asset::AssetLoader; use std::{path::Path, sync::Arc}; +/// A source of audio data #[derive(Clone)] pub struct AudioSource { pub bytes: Arc>, @@ -13,6 +14,7 @@ impl AsRef<[u8]> for AudioSource { } } +/// Loads mp3 files as [AudioSource] [Assets](bevy_asset::Assets) #[derive(Default)] pub struct Mp3Loader; diff --git a/crates/bevy_audio/src/lib.rs b/crates/bevy_audio/src/lib.rs index 40fc7979d3..46270278f5 100644 --- a/crates/bevy_audio/src/lib.rs +++ b/crates/bevy_audio/src/lib.rs @@ -12,6 +12,7 @@ use bevy_app::prelude::*; use bevy_asset::AddAsset; use bevy_ecs::IntoQuerySystem; +/// Adds support for audio playback to an App #[derive(Default)] pub struct AudioPlugin; diff --git a/crates/bevy_core/src/bytes.rs b/crates/bevy_core/src/bytes.rs index f77d8128ec..b10132d23e 100644 --- a/crates/bevy_core/src/bytes.rs +++ b/crates/bevy_core/src/bytes.rs @@ -2,11 +2,16 @@ use bevy_math::{Mat4, Vec2, Vec3, Vec4}; pub use bevy_derive::Bytes; +/// Converts the implementing type to bytes by writing them to a given buffer pub trait Bytes { + /// Converts the implementing type to bytes by writing them to a given buffer fn write_bytes(&self, buffer: &mut [u8]); + + /// The number of bytes that will be written when calling `write_bytes` fn byte_len(&self) -> usize; } +/// A trait that indicates that it is safe to cast the type to a byte array reference. pub unsafe trait Byteable where Self: Sized, @@ -27,11 +32,15 @@ where } } +/// Reads the implementing type as a byte array reference pub trait AsBytes { + /// Reads the implementing type as a byte array reference fn as_bytes(&self) -> &[u8]; } +/// Converts a byte array to `Self` pub trait FromBytes { + /// Converts a byte array to `Self` fn from_bytes(bytes: &[u8]) -> Self; } diff --git a/crates/bevy_core/src/float_ord.rs b/crates/bevy_core/src/float_ord.rs index 46d6042c01..7e55e8db1e 100644 --- a/crates/bevy_core/src/float_ord.rs +++ b/crates/bevy_core/src/float_ord.rs @@ -5,7 +5,9 @@ use std::{ ops::Neg, }; -// working around the famous "rust float ordering" problem +/// A wrapper type that enables ordering floats. This is a work around for the famous "rust float ordering" problem. +/// By using it, you acknowledge that sorting NaN is undefined according to spec. This implementation treats NaN as the +/// "smallest" float. #[derive(Debug, Copy, Clone, PartialOrd)] pub struct FloatOrd(pub f32); diff --git a/crates/bevy_core/src/label.rs b/crates/bevy_core/src/label.rs index d24807651a..9f37cb4ada 100644 --- a/crates/bevy_core/src/label.rs +++ b/crates/bevy_core/src/label.rs @@ -7,6 +7,7 @@ use std::{ ops::{Deref, DerefMut}, }; +/// A collection of labels #[derive(Default, Properties)] pub struct Labels { labels: HashSet>, @@ -50,6 +51,7 @@ impl Labels { } } +/// Maintains a mapping from [Entity](bevy_ecs::prelude::Entity) ids to entity labels and entity labels to [Entities](bevy_ecs::prelude::Entity). #[derive(Default)] pub struct EntityLabels { label_entities: HashMap, Vec>, @@ -64,7 +66,7 @@ impl EntityLabels { } } -pub fn entity_labels_system( +pub(crate) fn entity_labels_system( mut entity_labels: ResMut, // TODO: use change tracking when add/remove events are added // mut query: Query<(Entity, Changed)>, diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index 9e9121e02d..c1e8f7169f 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -17,6 +17,7 @@ use bevy_ecs::prelude::*; use bevy_math::{Mat3, Mat4, Quat, Vec2, Vec3}; use bevy_type_registry::RegisterType; +/// Adds core functionality to Apps. #[derive(Default)] pub struct CorePlugin; @@ -32,6 +33,7 @@ impl Plugin for CorePlugin { .register_property::() .register_property::>() .add_system_to_stage(stage::FIRST, time_system.system()) - .add_system_to_stage(stage::FIRST, timer_system.system()); + .add_system_to_stage(stage::FIRST, timer_system.system()) + .add_system_to_stage(stage::PRE_UPDATE, entity_labels_system.system()); } } diff --git a/crates/bevy_core/src/time/time.rs b/crates/bevy_core/src/time/time.rs index 05a396ae71..a1d1d98746 100644 --- a/crates/bevy_core/src/time/time.rs +++ b/crates/bevy_core/src/time/time.rs @@ -1,6 +1,7 @@ use bevy_ecs::ResMut; use std::time::{Duration, Instant}; +/// Tracks elapsed time since the last update and since the App has started pub struct Time { pub delta: Duration, pub instant: Option, @@ -42,6 +43,6 @@ impl Time { } } -pub fn time_system(mut time: ResMut