move universe into Resources

This commit is contained in:
Carter Anderson 2020-05-19 12:20:14 -07:00
parent 8bc0eb45ee
commit a88982fbfb
3 changed files with 3 additions and 16 deletions

View File

@ -2,7 +2,6 @@ use super::AppBuilder;
use legion::prelude::*;
pub struct App {
pub universe: Universe,
pub world: World,
pub resources: Resources,
pub runner: Option<Box<dyn Fn(App)>>,
@ -13,9 +12,9 @@ impl Default for App {
fn default() -> Self {
let universe = Universe::new();
let world = universe.create_world();
let resources = Resources::default();
let mut resources = Resources::default();
resources.insert(universe);
App {
universe,
world,
resources,
runner: None,

View File

@ -4,7 +4,7 @@ use crate::{
stage, App, AppExit, Events, FromResources, System,
};
use legion::prelude::{IntoSystem, Resources, Universe, World};
use legion::prelude::{IntoSystem, Resources, World};
static APP_MISSING_MESSAGE: &str = "This AppBuilder no longer has an App. Check to see if you already called run(). A call to app_builder.run() consumes the AppBuilder's App.";
@ -53,14 +53,6 @@ impl AppBuilder {
&mut self.app_mut().world
}
pub fn universe(&self) -> &Universe {
&self.app().universe
}
pub fn universe_mut(&mut self) -> &mut Universe {
&mut self.app_mut().universe
}
pub fn resources(&self) -> &Resources {
&self.app().resources
}

View File

@ -1,7 +1,3 @@
mod world;
pub use world::*;
pub fn type_name_of_val<T>(_: T) -> &'static str {
std::any::type_name::<T>()
}