move plugin to core
This commit is contained in:
		
							parent
							
								
									45d4f25a93
								
							
						
					
					
						commit
						e2393de97c
					
				| @ -1,8 +1,7 @@ | ||||
| use crate::{ | ||||
|     app::{system_stage, App}, | ||||
|     core::{winit::WinitPlugin, CorePlugin}, | ||||
|     core::{plugin::{AppPlugin, load_plugin}, winit::WinitPlugin, CorePlugin}, | ||||
|     legion::prelude::{Resources, Runnable, Schedulable, Schedule, Universe, World}, | ||||
|     plugin::{load_plugin, AppPlugin}, | ||||
|     render::{renderer::Renderer, *}, | ||||
|     ui, | ||||
| }; | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| use super::{Time, Window}; | ||||
| use crate::{app::AppBuilder, plugin::AppPlugin}; | ||||
| use super::{Time, Window, plugin::AppPlugin}; | ||||
| use crate::{app::AppBuilder}; | ||||
| 
 | ||||
| #[derive(Default)] | ||||
| pub struct CorePlugin; | ||||
| @ -9,6 +9,7 @@ impl AppPlugin for CorePlugin { | ||||
|         app.add_resource(Window::default()) | ||||
|             .add_resource(Time::new()) | ||||
|     } | ||||
| 
 | ||||
|     fn name(&self) -> &'static str { | ||||
|         "Core" | ||||
|     } | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| pub mod bytes; | ||||
| mod time; | ||||
| pub mod window; | ||||
| pub mod plugin; | ||||
| mod core_plugin; | ||||
| 
 | ||||
| pub use bytes::*; | ||||
|  | ||||
| @ -7,7 +7,7 @@ pub trait AppPlugin: Any + Send + Sync { | ||||
|     fn name(&self) -> &'static str; | ||||
| } | ||||
| 
 | ||||
| type CreateAppPlugin = unsafe fn() -> *mut dyn AppPlugin; | ||||
| pub type CreateAppPlugin = unsafe fn() -> *mut dyn AppPlugin; | ||||
| 
 | ||||
| pub fn load_plugin(path: &str) -> (Library, Box<dyn AppPlugin>) { | ||||
|     let lib = Library::new(path).unwrap(); | ||||
| @ -1,6 +1,5 @@ | ||||
| use crate::{ | ||||
|     app::{App, AppBuilder}, | ||||
|     plugin::AppPlugin, | ||||
|     app::{App, AppBuilder}, core::plugin::AppPlugin, | ||||
| }; | ||||
| 
 | ||||
| use super::Window; | ||||
|  | ||||
| @ -2,7 +2,7 @@ use super::{ | ||||
|     diagnostics::{frame_time_diagnostic_system, print_diagnostics_system}, | ||||
|     Diagnostics, | ||||
| }; | ||||
| use crate::{app::AppBuilder, plugin::AppPlugin}; | ||||
| use crate::{app::AppBuilder, core::plugin::AppPlugin}; | ||||
| use std::time::Duration; | ||||
| 
 | ||||
| pub struct DiagnosticsPlugin { | ||||
| @ -25,9 +25,8 @@ impl AppPlugin for DiagnosticsPlugin { | ||||
|     fn build(&self, mut app: AppBuilder) -> AppBuilder { | ||||
|         app = app.add_resource(Diagnostics::default()); | ||||
|         if self.add_defaults { | ||||
|             let frame_time_diagnostic_system = { | ||||
|                 frame_time_diagnostic_system(&mut app.resources, 10) | ||||
|             }; | ||||
|             let frame_time_diagnostic_system = | ||||
|                 { frame_time_diagnostic_system(&mut app.resources, 10) }; | ||||
|             app = app.add_system(frame_time_diagnostic_system) | ||||
|         } | ||||
| 
 | ||||
|  | ||||
| @ -4,7 +4,6 @@ pub mod asset; | ||||
| pub mod core; | ||||
| pub mod diagnostic; | ||||
| pub mod ecs; | ||||
| pub mod plugin; | ||||
| pub mod prelude; | ||||
| pub mod render; | ||||
| pub mod serialization; | ||||
|  | ||||
| @ -1,7 +1,7 @@ | ||||
| pub use crate::{ | ||||
|     app::{App, AppBuilder}, | ||||
|     asset::{Asset, AssetStorage, Handle}, | ||||
|     core::{Time, Window}, | ||||
|     core::{Time, Window, plugin::AppPlugin}, | ||||
|     ecs, | ||||
|     ecs::{ | ||||
|         default_archetypes::*, CommandBufferBuilderSource, EntityArchetype, WorldBuilder, | ||||
|  | ||||
| @ -11,12 +11,12 @@ use super::{ | ||||
|             MeshResourceProvider, UiResourceProvider, | ||||
|         }, | ||||
|         AssetBatchers, EntityRenderResourceAssignments, RenderResourceAssignments, | ||||
|     }, RenderContext, | ||||
|     }, | ||||
| }; | ||||
| use crate::{ | ||||
|     app::AppBuilder, | ||||
|     asset::AssetStorage, | ||||
|     plugin::AppPlugin, | ||||
|     core::plugin::AppPlugin, | ||||
|     prelude::{ | ||||
|         LocalToWorld, Mesh, PipelineDescriptor, Shader, StandardMaterial, Texture, | ||||
|         UniformResourceProvider, | ||||
| @ -57,7 +57,6 @@ impl AppPlugin for RenderPlugin { | ||||
|         let mut asset_batchers = AssetBatchers::default(); | ||||
|         asset_batchers.batch_types2::<Mesh, StandardMaterial>(); | ||||
|         app = app | ||||
|             .add_resource(RenderContext::default()) | ||||
|             .add_resource(RenderGraph::default()) | ||||
|             .add_resource(AssetStorage::<Mesh>::new()) | ||||
|             .add_resource(AssetStorage::<Texture>::new()) | ||||
|  | ||||
| @ -7,7 +7,7 @@ pub use wgpu_render_pass::*; | ||||
| pub use wgpu_renderer::*; | ||||
| pub use wgpu_resources::*; | ||||
| 
 | ||||
| use crate::{app::AppBuilder, plugin::AppPlugin}; | ||||
| use crate::{app::AppBuilder, core::plugin::AppPlugin}; | ||||
| 
 | ||||
| pub struct WgpuRendererPlugin; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Carter Anderson
						Carter Anderson