ecs: simplify imports
This commit is contained in:
parent
f742ce3ef2
commit
9f26a453c6
@ -12,15 +12,19 @@ pub use handle::*;
|
||||
pub use load_request::*;
|
||||
pub use loader::*;
|
||||
|
||||
use bevy_app::{prelude::AppPlugin, AppBuilder};
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
use bevy_type_registry::RegisterType;
|
||||
|
||||
pub mod stage {
|
||||
pub const LOAD_ASSETS: &str = "load_assets";
|
||||
pub const ASSET_EVENTS: &str = "asset_events";
|
||||
}
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::{AddAsset, AssetEvent, AssetServer, Assets, Handle};
|
||||
}
|
||||
|
||||
use bevy_app::{prelude::AppPlugin, AppBuilder};
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
use bevy_type_registry::RegisterType;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct AssetPlugin;
|
||||
|
||||
|
@ -4,6 +4,11 @@ mod audio_source;
|
||||
pub use audio_output::*;
|
||||
pub use audio_source::*;
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::{AudioOutput, AudioSource};
|
||||
}
|
||||
|
||||
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::AddAsset;
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
|
@ -6,8 +6,12 @@ pub use bytes::*;
|
||||
pub use float_ord::*;
|
||||
pub use time::*;
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::{Time, Timer};
|
||||
}
|
||||
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_math::{Mat3, Mat4, Quat, Vec2, Vec3};
|
||||
use bevy_type_registry::RegisterType;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::time::Time;
|
||||
use bevy_ecs::{Query, Res};
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_property::Properties;
|
||||
use std::time::Duration;
|
||||
|
||||
|
@ -1,21 +1,21 @@
|
||||
pub use hecs::{Query as HecsQuery, *};
|
||||
|
||||
mod commands;
|
||||
mod into_system;
|
||||
mod parallel_executor;
|
||||
#[cfg(feature = "profiler")]
|
||||
pub mod profiler;
|
||||
mod resource_query;
|
||||
mod resources;
|
||||
mod resource;
|
||||
mod schedule;
|
||||
mod system;
|
||||
mod world_builder;
|
||||
|
||||
pub use commands::{Commands, CommandsInternal};
|
||||
pub use into_system::{IntoForEachSystem, IntoQuerySystem, IntoThreadLocalSystem, Query};
|
||||
pub use parallel_executor::ParallelExecutor;
|
||||
pub use resource_query::{FetchResource, Local, Res, ResMut, ResourceQuery, UnsafeClone};
|
||||
pub use resources::{FromResources, Resource, Resources};
|
||||
pub use schedule::Schedule;
|
||||
pub use system::{ArchetypeAccess, System, SystemId, TypeAccess};
|
||||
pub use world_builder::{WorldBuilder, WorldBuilderSource};
|
||||
pub use resource::*;
|
||||
pub use schedule::*;
|
||||
pub use system::{*, Query};
|
||||
pub use world_builder::*;
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::{
|
||||
resource::{FromResources, Local, Res, ResMut, Resource, Resources},
|
||||
system::{
|
||||
Commands, IntoForEachSystem, IntoQuerySystem, IntoThreadLocalSystem, Query, System,
|
||||
},
|
||||
world_builder::WorldBuilderSource,
|
||||
Bundle, Component, Entity, Ref, RefMut, With, Without, World,
|
||||
};
|
||||
}
|
||||
|
5
crates/bevy_ecs/src/resource/mod.rs
Normal file
5
crates/bevy_ecs/src/resource/mod.rs
Normal file
@ -0,0 +1,5 @@
|
||||
mod resource_query;
|
||||
mod resources;
|
||||
|
||||
pub use resource_query::*;
|
||||
pub use resources::*;
|
@ -1,15 +1,14 @@
|
||||
use crate::{
|
||||
resources::FromResources,
|
||||
system::{SystemId, TypeAccess},
|
||||
Archetype, Component, Resources,
|
||||
};
|
||||
use core::{
|
||||
any::TypeId,
|
||||
ops::{Deref, DerefMut},
|
||||
ptr::NonNull,
|
||||
};
|
||||
use hecs::{smaller_tuples_too, MissingComponent};
|
||||
use hecs::{smaller_tuples_too, MissingComponent, Component, Archetype};
|
||||
use std::collections::HashMap;
|
||||
use super::{Resources, FromResources};
|
||||
/// Shared borrow of an entity's component
|
||||
pub struct Res<'a, T: Component> {
|
||||
archetype: &'a Archetype,
|
@ -1,10 +1,7 @@
|
||||
use crate::{
|
||||
resource_query::{FetchResource, ResourceQuery},
|
||||
system::SystemId,
|
||||
ComponentError, Res, ResMut, TypeInfo,
|
||||
};
|
||||
use super::{FetchResource, Res, ResMut, ResourceQuery};
|
||||
use crate::system::SystemId;
|
||||
use core::any::TypeId;
|
||||
use hecs::{Archetype, Ref, RefMut};
|
||||
use hecs::{Archetype, ComponentError, Ref, RefMut, TypeInfo};
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub trait Resource: Send + Sync + 'static {}
|
||||
@ -173,7 +170,8 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{system::SystemId, Resources};
|
||||
use super::Resources;
|
||||
use crate::system::SystemId;
|
||||
|
||||
#[test]
|
||||
fn resource() {
|
5
crates/bevy_ecs/src/schedule/mod.rs
Normal file
5
crates/bevy_ecs/src/schedule/mod.rs
Normal file
@ -0,0 +1,5 @@
|
||||
mod parallel_executor;
|
||||
mod schedule;
|
||||
|
||||
pub use parallel_executor::*;
|
||||
pub use schedule::*;
|
@ -1,6 +1,7 @@
|
||||
use super::Schedule;
|
||||
use crate::{
|
||||
system::{ArchetypeAccess, ThreadLocalExecution},
|
||||
Resources, Schedule, System, TypeAccess,
|
||||
resource::Resources,
|
||||
system::{ArchetypeAccess, System, ThreadLocalExecution, TypeAccess},
|
||||
};
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use fixedbitset::FixedBitSet;
|
||||
@ -328,9 +329,12 @@ impl ExecutorStage {
|
||||
mod tests {
|
||||
use super::ParallelExecutor;
|
||||
use crate::{
|
||||
IntoQuerySystem, IntoThreadLocalSystem, Query, Res, ResMut, Resources, Schedule, World,
|
||||
resource::{Res, ResMut, Resources},
|
||||
schedule::Schedule,
|
||||
system::{IntoQuerySystem, IntoThreadLocalSystem, Query},
|
||||
};
|
||||
use fixedbitset::FixedBitSet;
|
||||
use hecs::World;
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
#[derive(Default)]
|
@ -1,12 +1,12 @@
|
||||
use crate::{
|
||||
system::{System, ThreadLocalExecution},
|
||||
Resources, SystemId, World,
|
||||
system::{System, ThreadLocalExecution, SystemId}, resource::Resources,
|
||||
};
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
collections::{HashMap, HashSet},
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
use hecs::World;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct Schedule {
|
@ -1,5 +1,6 @@
|
||||
use crate::{DynamicBundle, Resource, Resources, SystemId, World};
|
||||
use hecs::{Bundle, Component, Entity};
|
||||
use super::SystemId;
|
||||
use crate::resource::{Resource, Resources};
|
||||
use hecs::{Bundle, Component, DynamicBundle, Entity, World};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub enum Command {
|
||||
@ -311,7 +312,9 @@ impl Commands {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{Commands, Resources, World};
|
||||
use super::Commands;
|
||||
use crate::resource::Resources;
|
||||
use hecs::World;
|
||||
|
||||
#[test]
|
||||
fn command_buffer() {
|
@ -1,7 +1,7 @@
|
||||
use super::TypeAccess;
|
||||
use crate::{
|
||||
resource_query::{FetchResource, ResourceQuery, UnsafeClone},
|
||||
system::{ArchetypeAccess, System, SystemId, ThreadLocalExecution},
|
||||
Commands, Resources, TypeAccess,
|
||||
resource::{FetchResource, ResourceQuery, Resources, UnsafeClone},
|
||||
system::{ArchetypeAccess, Commands, System, SystemId, ThreadLocalExecution},
|
||||
};
|
||||
use core::marker::PhantomData;
|
||||
use hecs::{
|
||||
@ -406,8 +406,11 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::IntoQuerySystem;
|
||||
use crate::{Query, ResMut, Resources, Schedule};
|
||||
use super::{IntoQuerySystem, Query};
|
||||
use crate::{
|
||||
resource::{ResMut, Resources},
|
||||
schedule::Schedule,
|
||||
};
|
||||
use hecs::{Entity, With, World};
|
||||
|
||||
struct A;
|
11
crates/bevy_ecs/src/system/mod.rs
Normal file
11
crates/bevy_ecs/src/system/mod.rs
Normal file
@ -0,0 +1,11 @@
|
||||
mod commands;
|
||||
mod into_system;
|
||||
#[cfg(feature = "profiler")]
|
||||
mod profiler;
|
||||
mod system;
|
||||
|
||||
pub use commands::*;
|
||||
pub use into_system::*;
|
||||
#[cfg(feature = "profiler")]
|
||||
pub use profiler::*;
|
||||
pub use system::*;
|
@ -1,6 +1,6 @@
|
||||
use crate::{Resources, World};
|
||||
use crate::resource::Resources;
|
||||
use fixedbitset::FixedBitSet;
|
||||
use hecs::{Access, Query};
|
||||
use hecs::{Access, Query, World};
|
||||
use std::{any::TypeId, borrow::Cow, collections::HashSet};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
@ -100,9 +100,9 @@ impl TypeAccess {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{ArchetypeAccess, TypeAccess};
|
||||
use crate::{FetchResource, Res, ResMut, ResourceQuery};
|
||||
use hecs::World;
|
||||
use std::any::TypeId;
|
||||
use crate::resource::{Res, ResourceQuery, ResMut, FetchResource};
|
||||
|
||||
struct A;
|
||||
struct B;
|
@ -1,4 +1,4 @@
|
||||
use crate::{Bundle, Component, DynamicBundle, Entity, World};
|
||||
use hecs::{Bundle, Component, DynamicBundle, Entity, World};
|
||||
|
||||
pub trait WorldBuilderSource {
|
||||
fn build(&mut self) -> WorldBuilder;
|
||||
|
@ -9,7 +9,7 @@ pub mod prelude {
|
||||
}
|
||||
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::{IntoQuerySystem, System};
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_type_registry::RegisterType;
|
||||
use prelude::{Children, LocalTransform, NonUniformScale, Rotation, Scale, Transform, Translation};
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#![allow(dead_code)]
|
||||
use crate::components::*;
|
||||
|
||||
use bevy_ecs::{IntoQuerySystem, Query, System, Without};
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_math::{Mat4, Quat, Vec3};
|
||||
|
||||
// TODO: "on changed" for all of these systems
|
||||
|
@ -1,6 +1,6 @@
|
||||
#![allow(dead_code)]
|
||||
use crate::components::*;
|
||||
use bevy_ecs::{Commands, Entity, Query, Without};
|
||||
use bevy_ecs::prelude::*;
|
||||
|
||||
pub fn transform_propagate_system(
|
||||
mut commands: Commands,
|
||||
|
@ -1,7 +1,7 @@
|
||||
#![allow(dead_code)]
|
||||
use crate::components::*;
|
||||
|
||||
use bevy_ecs::{IntoQuerySystem, Query, System, Without};
|
||||
use bevy_ecs::prelude::*;
|
||||
use bevy_math::{Mat4, Quat, Vec3};
|
||||
|
||||
// TODO: on changed for all of these systems
|
||||
|
@ -5,7 +5,6 @@ fn main() {
|
||||
.add_default_plugins()
|
||||
.add_startup_system(setup.system())
|
||||
.add_system(placement_system.system())
|
||||
.add_plugin(DiagnosticsPlugin::default())
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,9 @@
|
||||
pub use crate::{
|
||||
app::prelude::*,
|
||||
asset::{AddAsset, AssetEvent, AssetServer, Assets, Handle},
|
||||
audio::{AudioOutput, AudioSource},
|
||||
core::{Time, Timer},
|
||||
diagnostic::DiagnosticsPlugin,
|
||||
ecs::{
|
||||
Bundle, Commands, Component, Entity, FromResources, IntoForEachSystem, IntoQuerySystem,
|
||||
IntoThreadLocalSystem, Local, Query, Ref, RefMut, Res, ResMut, Resource, Resources, System,
|
||||
World, WorldBuilderSource,
|
||||
},
|
||||
asset::prelude::*,
|
||||
audio::prelude::*,
|
||||
core::prelude::*,
|
||||
ecs::prelude::*,
|
||||
input::{keyboard::KeyCode, mouse::MouseButton, Input},
|
||||
math::{self, FaceToward, Mat3, Mat4, Quat, Vec2, Vec3, Vec4},
|
||||
pbr::{entity::*, light::Light, material::StandardMaterial},
|
||||
|
Loading…
Reference in New Issue
Block a user