From 265413748d2bed31f6363116d5c2255ccb896a5d Mon Sep 17 00:00:00 2001 From: Joy <51241057+maniwani@users.noreply.github.com> Date: Thu, 21 Oct 2021 14:17:37 -0700 Subject: [PATCH 01/27] Make time more relevant and simplify fixed timestep There can be only one!!! --- crates/bevy_core/src/lib.rs | 26 +- crates/bevy_core/src/time/fixed_timestep.rs | 322 ++++---------------- crates/bevy_core/src/time/time.rs | 233 ++++++++++---- examples/2d/text2d.rs | 8 +- examples/3d/spawner.rs | 75 +++++ examples/3d/update_gltf_scene.rs | 12 +- examples/ecs/component_change_detection.rs | 2 +- examples/ecs/fixed_timestep.rs | 50 +-- examples/ecs/iter_combinations.rs | 112 +++---- examples/ecs/state.rs | 67 ++-- examples/game/alien_cake_addict.rs | 11 +- examples/game/breakout.rs | 122 +++----- examples/shader/animate_shader.rs | 318 ++++++------------- examples/ui/text.rs | 2 +- 14 files changed, 598 insertions(+), 762 deletions(-) create mode 100644 examples/3d/spawner.rs diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index f943b281426cfc..10daf75022e312 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -1,21 +1,22 @@ -#![warn(missing_docs)] -//! This crate provides core functionality for Bevy Engine. - +mod bytes; mod float_ord; +mod label; mod name; mod task_pool_options; mod time; -pub use bytemuck::{bytes_of, cast_slice, Pod, Zeroable}; +pub use bytes::*; pub use float_ord::*; +pub use label::*; pub use name::*; pub use task_pool_options::DefaultTaskPoolOptions; pub use time::*; pub mod prelude { - //! The Bevy Core Prelude. #[doc(hidden)] - pub use crate::{DefaultTaskPoolOptions, Name, Time, Timer}; + pub use crate::{ + DefaultTaskPoolOptions, EntityLabels, FixedTimestep, Labels, Name, Time, Timer + }; } use bevy_app::prelude::*; @@ -31,11 +32,10 @@ use std::ops::Range; #[derive(Default)] pub struct CorePlugin; -/// A `SystemLabel` enum for ordering systems relative to core Bevy systems. #[derive(Debug, PartialEq, Eq, Clone, Hash, SystemLabel)] pub enum CoreSystem { - /// Updates the elapsed time. Any system that interacts with [Time] component should run after - /// this. + /// Updates the elapsed time. + /// Any system interacting with the [`Time`] resource should run after this. Time, } @@ -49,11 +49,13 @@ impl Plugin for CorePlugin { .create_default_pools(&mut app.world); app.init_resource::