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