rename entitybuilder to worldbuilder
This commit is contained in:
parent
649e1b113f
commit
edf57c0dd3
@ -1,9 +1,9 @@
|
|||||||
pub mod default_archetypes;
|
pub mod default_archetypes;
|
||||||
mod entity_archetype;
|
mod entity_archetype;
|
||||||
mod entity_builder;
|
mod world_builder;
|
||||||
|
|
||||||
pub use entity_archetype::*;
|
pub use entity_archetype::*;
|
||||||
pub use entity_builder::*;
|
pub use world_builder::*;
|
||||||
|
|
||||||
use bevy_transform::prelude::Children;
|
use bevy_transform::prelude::Children;
|
||||||
use legion::{
|
use legion::{
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
use crate::ecs::EntityArchetype;
|
use crate::ecs::EntityArchetype;
|
||||||
use legion::{world::{TagSet, TagLayout, IntoComponentSource}, prelude::*, filter::{Filter, ChunksetFilterData}};
|
use legion::{world::{TagSet, TagLayout, IntoComponentSource}, prelude::*, filter::{Filter, ChunksetFilterData}};
|
||||||
|
|
||||||
pub trait EntityBuilderSource {
|
pub trait WorldBuilderSource {
|
||||||
fn build(&mut self) -> EntityBuilder;
|
fn build(&mut self) -> WorldBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EntityBuilderSource for World {
|
impl WorldBuilderSource for World {
|
||||||
fn build(&mut self) -> EntityBuilder {
|
fn build(&mut self) -> WorldBuilder {
|
||||||
EntityBuilder {
|
WorldBuilder {
|
||||||
world: self,
|
world: self,
|
||||||
current_entity: None,
|
current_entity: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct EntityBuilder<'a> {
|
pub struct WorldBuilder<'a> {
|
||||||
world: &'a mut World,
|
world: &'a mut World,
|
||||||
current_entity: Option<Entity>,
|
current_entity: Option<Entity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> EntityBuilder<'a> {
|
impl<'a> WorldBuilder<'a> {
|
||||||
pub fn build_entity(mut self) -> Self {
|
pub fn build_entity(mut self) -> Self {
|
||||||
let entity = *self.world.insert((), vec![()]).first().unwrap();
|
let entity = *self.world.insert((), vec![()]).first().unwrap();
|
||||||
self.current_entity = Some(entity);
|
self.current_entity = Some(entity);
|
@ -3,7 +3,7 @@ pub use crate::{
|
|||||||
asset::{Asset, AssetStorage, Handle, Mesh, MeshType, Texture, TextureType},
|
asset::{Asset, AssetStorage, Handle, Mesh, MeshType, Texture, TextureType},
|
||||||
core::Time,
|
core::Time,
|
||||||
ecs,
|
ecs,
|
||||||
ecs::{default_archetypes::*, EntityArchetype, EntityBuilder, EntityBuilderSource},
|
ecs::{default_archetypes::*, EntityArchetype, WorldBuilder, WorldBuilderSource},
|
||||||
render::{
|
render::{
|
||||||
ActiveCamera, ActiveCamera2d, Albedo, Camera, CameraType, Instanced, Light, Material,
|
ActiveCamera, ActiveCamera2d, Albedo, Camera, CameraType, Instanced, Light, Material,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user