mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
app: simplify app imports
This commit is contained in:
parent
b12c4d0a48
commit
f742ce3ef2
44 changed files with 74 additions and 52 deletions
|
@ -1,4 +1,4 @@
|
|||
use super::AppBuilder;
|
||||
use crate::app_builder::AppBuilder;
|
||||
use bevy_ecs::{ParallelExecutor, Resources, Schedule, World};
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use crate::{
|
||||
plugin::{load_plugin, AppPlugin},
|
||||
stage, startup_stage, App, AppExit, Events,
|
||||
stage, startup_stage, app::{AppExit, App}, event::Events
|
||||
};
|
||||
|
||||
use bevy_ecs::{FromResources, IntoQuerySystem, Resources, System, World};
|
||||
|
||||
pub struct AppBuilder {
|
||||
|
|
|
@ -1,13 +1,26 @@
|
|||
pub mod stage;
|
||||
|
||||
mod app;
|
||||
mod app_builder;
|
||||
mod event;
|
||||
mod plugin;
|
||||
pub mod schedule_runner;
|
||||
pub mod stage;
|
||||
pub mod startup_stage;
|
||||
mod schedule_runner;
|
||||
mod startup_stage;
|
||||
|
||||
pub use app::*;
|
||||
pub use app_builder::*;
|
||||
pub use bevy_derive::DynamicAppPlugin;
|
||||
pub use event::*;
|
||||
pub use plugin::*;
|
||||
pub use schedule_runner::*;
|
||||
pub use startup_stage::*;
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::{
|
||||
app::App,
|
||||
app_builder::AppBuilder,
|
||||
event::{EventReader, Events},
|
||||
plugin::AppPlugin,
|
||||
stage, DynamicAppPlugin,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::AppBuilder;
|
||||
use libloading::{Library, Symbol};
|
||||
use std::any::Any;
|
||||
use crate::AppBuilder;
|
||||
|
||||
pub trait AppPlugin: Any + Send + Sync {
|
||||
fn build(&self, app: &mut AppBuilder);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::{App, AppBuilder, AppPlugin};
|
||||
use crate::{AppExit, EventReader, Events};
|
||||
use super::{App, AppBuilder};
|
||||
use std::{thread, time::Duration};
|
||||
use crate::{event::{Events, EventReader}, plugin::AppPlugin, app::AppExit};
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum RunMode {
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
update_asset_storage_system, AssetChannel, AssetLoader, AssetServer, ChannelAssetHandler,
|
||||
Handle, HandleId,
|
||||
};
|
||||
use bevy_app::{AppBuilder, Events};
|
||||
use bevy_app::{prelude::Events, AppBuilder};
|
||||
use bevy_ecs::{FromResources, IntoQuerySystem, ResMut, Resource};
|
||||
use bevy_type_registry::RegisterType;
|
||||
use std::collections::HashMap;
|
||||
|
|
|
@ -12,7 +12,7 @@ pub use handle::*;
|
|||
pub use load_request::*;
|
||||
pub use loader::*;
|
||||
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_app::{prelude::AppPlugin, AppBuilder};
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
use bevy_type_registry::RegisterType;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ mod audio_source;
|
|||
pub use audio_output::*;
|
||||
pub use audio_source::*;
|
||||
|
||||
use bevy_app::{stage, AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::AddAsset;
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ pub use bytes::*;
|
|||
pub use float_ord::*;
|
||||
pub use time::*;
|
||||
|
||||
use bevy_app::{stage, AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
use bevy_math::{Mat3, Mat4, Quat, Vec2, Vec3};
|
||||
use bevy_type_registry::RegisterType;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{Diagnostic, DiagnosticId, Diagnostics};
|
||||
use bevy_app::AppPlugin;
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_core::Time;
|
||||
use bevy_ecs::{IntoQuerySystem, Res, ResMut};
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ pub use diagnostic::*;
|
|||
pub use frame_time_diagnostics_plugin::FrameTimeDiagnosticsPlugin;
|
||||
pub use print_diagnostics_plugin::PrintDiagnosticsPlugin;
|
||||
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
|
||||
pub struct PrintDiagnostics {}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use super::{Diagnostic, DiagnosticId, Diagnostics};
|
||||
use bevy_app::{stage, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_core::{Time, Timer};
|
||||
use bevy_ecs::{IntoQuerySystem, Res, ResMut};
|
||||
use std::time::Duration;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
mod loader;
|
||||
pub use loader::*;
|
||||
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::AddAsset;
|
||||
use bevy_render::mesh::Mesh;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::Input;
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_ecs::{Res, ResMut};
|
||||
use bevy_app::prelude::*;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct KeyboardInput {
|
||||
|
|
|
@ -5,7 +5,7 @@ pub mod system;
|
|||
|
||||
pub use input::*;
|
||||
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use keyboard::{keyboard_input_system, KeyCode, KeyboardInput, KeyboardInputState};
|
||||
use mouse::{
|
||||
mouse_button_input_system, MouseButton, MouseButtonInput, MouseButtonInputState, MouseMotion,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use super::keyboard::ElementState;
|
||||
use crate::Input;
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_app::prelude::{EventReader, Events};
|
||||
use bevy_ecs::{Res, ResMut};
|
||||
use bevy_math::Vec2;
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
use crate::keyboard::{ElementState, KeyCode, KeyboardInput};
|
||||
use bevy_app::{AppExit, EventReader, Events};
|
||||
use bevy_app::{
|
||||
prelude::{EventReader, Events},
|
||||
AppExit,
|
||||
};
|
||||
use bevy_ecs::{Local, Res, ResMut};
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -7,7 +7,7 @@ pub mod pipelines;
|
|||
mod forward_pbr_render_graph;
|
||||
pub use forward_pbr_render_graph::*;
|
||||
|
||||
use bevy_app::{stage, AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::AddAsset;
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
use bevy_render::{render_graph::RenderGraph, shader};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use super::CameraProjection;
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_ecs::{Component, Local, Query, Res};
|
||||
use bevy_math::Mat4;
|
||||
use bevy_property::Properties;
|
||||
use bevy_window::{WindowCreated, WindowReference, WindowResized, Windows};
|
||||
use bevy_app::prelude::{Events, EventReader};
|
||||
|
||||
#[derive(Default, Debug, Properties)]
|
||||
pub struct Camera {
|
||||
|
|
|
@ -9,7 +9,6 @@ pub mod render_graph;
|
|||
pub mod renderer;
|
||||
pub mod shader;
|
||||
pub mod texture;
|
||||
pub mod vertex;
|
||||
|
||||
mod entity;
|
||||
pub use once_cell;
|
||||
|
@ -22,7 +21,7 @@ pub mod prelude {
|
|||
}
|
||||
|
||||
use crate::prelude::*;
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::AddAsset;
|
||||
use bevy_ecs::{IntoQuerySystem, IntoThreadLocalSystem};
|
||||
use bevy_type_registry::RegisterType;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
use super::Vertex;
|
||||
use crate::{
|
||||
pipeline::{
|
||||
AsVertexBufferDescriptor, IndexFormat, PrimitiveTopology, RenderPipelines,
|
||||
VertexBufferDescriptor, VertexBufferDescriptors, VertexFormat,
|
||||
},
|
||||
renderer::{BufferInfo, BufferUsage, RenderResourceContext, RenderResourceId},
|
||||
vertex::Vertex,
|
||||
};
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_app::prelude::{EventReader, Events};
|
||||
use bevy_asset::{AssetEvent, Assets, Handle};
|
||||
use bevy_core::AsBytes;
|
||||
use bevy_ecs::{Local, Query, Res, ResMut};
|
||||
|
@ -509,7 +509,7 @@ pub fn mesh_resource_provider_system(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{AsVertexBufferDescriptor, Mesh, VertexAttribute};
|
||||
use crate::{pipeline::PrimitiveTopology, vertex::Vertex};
|
||||
use crate::{mesh::Vertex, pipeline::PrimitiveTopology};
|
||||
use bevy_core::AsBytes;
|
||||
|
||||
#[test]
|
5
crates/bevy_render/src/mesh/mod.rs
Normal file
5
crates/bevy_render/src/mesh/mod.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
mod mesh;
|
||||
mod vertex;
|
||||
|
||||
pub use mesh::*;
|
||||
pub use vertex::*;
|
|
@ -3,7 +3,7 @@ use crate::{
|
|||
renderer::{BufferInfo, BufferUsage, RenderContext},
|
||||
texture::{Texture, TextureDescriptor, TEXTURE_ASSET_INDEX},
|
||||
};
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_app::prelude::{EventReader, Events};
|
||||
use bevy_asset::{AssetEvent, Assets};
|
||||
use bevy_ecs::{Resources, World};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ use crate::{
|
|||
render_graph::{Node, ResourceSlotInfo, ResourceSlots},
|
||||
renderer::{RenderContext, RenderResourceId, RenderResourceType},
|
||||
};
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_app::prelude::{EventReader, Events};
|
||||
use bevy_ecs::{Resources, World};
|
||||
use bevy_window::{WindowCreated, WindowReference, WindowResized, Windows};
|
||||
use std::borrow::Cow;
|
||||
|
|
|
@ -3,7 +3,7 @@ use crate::{
|
|||
renderer::{RenderContext, RenderResourceId, RenderResourceType},
|
||||
texture::TextureDescriptor,
|
||||
};
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_app::prelude::{EventReader, Events};
|
||||
use bevy_ecs::{Resources, World};
|
||||
use bevy_window::{WindowCreated, WindowReference, WindowResized, Windows};
|
||||
use std::borrow::Cow;
|
||||
|
|
|
@ -2,7 +2,7 @@ use super::{SamplerDescriptor, TextureDescriptor};
|
|||
use crate::renderer::{
|
||||
RenderResource, RenderResourceContext, RenderResourceId, RenderResourceType,
|
||||
};
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_app::prelude::{EventReader, Events};
|
||||
use bevy_asset::{AssetEvent, Assets, Handle};
|
||||
use bevy_ecs::{Res, ResMut};
|
||||
use bevy_math::Vec2;
|
||||
|
|
|
@ -7,7 +7,7 @@ pub use loaded_scenes::*;
|
|||
pub use scene::*;
|
||||
pub use scene_spawner::*;
|
||||
|
||||
use bevy_app::{stage, AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::AddAsset;
|
||||
use bevy_ecs::IntoThreadLocalSystem;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::Scene;
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::{AssetEvent, Assets, Handle};
|
||||
use bevy_ecs::{Resources, World};
|
||||
use bevy_type_registry::TypeRegistry;
|
||||
|
|
|
@ -16,7 +16,7 @@ pub use sprite::*;
|
|||
pub use texture_atlas::*;
|
||||
pub use texture_atlas_builder::*;
|
||||
|
||||
use bevy_app::{stage, AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::{AddAsset, Assets, Handle};
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
use bevy_math::Vec2;
|
||||
|
|
|
@ -10,7 +10,7 @@ pub use font_atlas::*;
|
|||
pub use font_atlas_set::*;
|
||||
pub use font_loader::*;
|
||||
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_asset::AddAsset;
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -8,7 +8,7 @@ pub mod prelude {
|
|||
pub use crate::{components::*, hierarchy::*, TransformPlugin};
|
||||
}
|
||||
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::{IntoQuerySystem, System};
|
||||
use bevy_type_registry::RegisterType;
|
||||
use prelude::{Children, LocalTransform, NonUniformScale, Rotation, Scale, Transform, Translation};
|
||||
|
|
|
@ -4,7 +4,7 @@ mod type_registry;
|
|||
pub use register_type::*;
|
||||
pub use type_registry::*;
|
||||
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_property::DynamicProperties;
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -12,7 +12,7 @@ pub use node::*;
|
|||
pub use render::*;
|
||||
pub use ui_update_system::*;
|
||||
|
||||
use bevy_app::{stage, AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
use bevy_render::render_graph::RenderGraph;
|
||||
use widget::Label;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::renderer::WgpuRenderResourceContext;
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_diagnostic::{Diagnostic, DiagnosticId, Diagnostics};
|
||||
use bevy_ecs::{IntoQuerySystem, Res, ResMut};
|
||||
use bevy_render::renderer::RenderResourceContext;
|
||||
|
|
|
@ -9,7 +9,7 @@ pub use wgpu_render_pass::*;
|
|||
pub use wgpu_renderer::*;
|
||||
pub use wgpu_resources::*;
|
||||
|
||||
use bevy_app::{AppBuilder, AppPlugin};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::{IntoQuerySystem, IntoThreadLocalSystem, Resources, World};
|
||||
use bevy_render::renderer::{free_shared_buffers_system, RenderResourceContext, SharedBuffers};
|
||||
use renderer::WgpuRenderResourceContext;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::renderer::{WgpuRenderGraphExecutor, WgpuRenderResourceContext};
|
||||
use bevy_app::{EventReader, Events};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::{Resources, World};
|
||||
use bevy_render::{
|
||||
render_graph::{DependentNodeStager, RenderGraph, RenderGraphStager},
|
||||
|
|
|
@ -8,7 +8,7 @@ pub use system::*;
|
|||
pub use window::*;
|
||||
pub use windows::*;
|
||||
|
||||
use bevy_app::{AppBuilder, AppPlugin, Events};
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_ecs::IntoQuerySystem;
|
||||
|
||||
pub struct WindowPlugin {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
use crate::WindowCloseRequested;
|
||||
use bevy_app::{AppExit, EventReader, Events};
|
||||
use bevy_app::{
|
||||
prelude::{EventReader, Events},
|
||||
AppExit,
|
||||
};
|
||||
use bevy_ecs::{Local, Res, ResMut};
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -7,7 +7,7 @@ use bevy_input::{
|
|||
mouse::{MouseButtonInput, MouseMotion},
|
||||
};
|
||||
|
||||
use bevy_app::{App, AppBuilder, AppExit, AppPlugin, EventReader, Events};
|
||||
use bevy_app::{prelude::*, AppExit};
|
||||
use bevy_ecs::Resources;
|
||||
use bevy_math::Vec2;
|
||||
use bevy_window::{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use bevy::prelude::*;
|
||||
use bevy::{app::ScheduleRunnerPlugin, prelude::*};
|
||||
use std::time::Duration;
|
||||
|
||||
// This example disables the default plugins by not registering them during setup.
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
use bevy::{app::AppExit, prelude::*};
|
||||
use bevy::{
|
||||
app::{AppExit, ScheduleRunnerPlugin},
|
||||
prelude::*,
|
||||
};
|
||||
use rand::random;
|
||||
use std::time::Duration;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use bevy::{app::schedule_runner::ScheduleRunnerPlugin, prelude::*};
|
||||
use bevy::{app::ScheduleRunnerPlugin, prelude::*};
|
||||
|
||||
fn main() {
|
||||
App::build()
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
pub use crate::{
|
||||
app::{
|
||||
schedule_runner::ScheduleRunnerPlugin, stage, App, AppBuilder, AppPlugin, DynamicAppPlugin,
|
||||
EventReader, Events,
|
||||
},
|
||||
app::prelude::*,
|
||||
asset::{AddAsset, AssetEvent, AssetServer, Assets, Handle},
|
||||
audio::{AudioOutput, AudioSource},
|
||||
core::{Time, Timer},
|
||||
|
|
Loading…
Reference in a new issue