pub struct World<E, Ctx> where
E: EntityStore, { /* private fields */ }
Expand description
The World
struct represents the main interface of the library. It used
as storage of entities, components and systems.
Implementations
sourceimpl<E, Ctx> World<E, Ctx> where
E: EntityStore,
impl<E, Ctx> World<E, Ctx> where
E: EntityStore,
sourcepub fn from_entity_store(entity_store: E) -> Self
pub fn from_entity_store(entity_store: E) -> Self
Creates a new world from the given entity store.
sourcepub fn create_entity(&mut self) -> EntityBuilder<'_, E>
pub fn create_entity(&mut self) -> EntityBuilder<'_, E>
Creates a new entity and returns a returns an TypeEntityBuilder
.
sourcepub fn remove_entity(&mut self, entity: impl Into<Entity>)
pub fn remove_entity(&mut self, entity: impl Into<Entity>)
Deletes the given entity
.
sourcepub fn register_init_system(&mut self, init_system: impl System<E, Ctx>)
pub fn register_init_system(&mut self, init_system: impl System<E, Ctx>)
Registers the init system.
sourcepub fn register_cleanup_system(&mut self, cleanup_system: impl System<E, Ctx>)
pub fn register_cleanup_system(&mut self, cleanup_system: impl System<E, Ctx>)
Registers the cleanup system.
sourcepub fn create_system(
&mut self,
system: impl System<E, Ctx>
) -> SystemStoreBuilder<'_, E, Ctx>
pub fn create_system(
&mut self,
system: impl System<E, Ctx>
) -> SystemStoreBuilder<'_, E, Ctx>
Creates a new entity system and returns a returns an SystemStoreBuilder
.
sourcepub fn remove_system(&mut self, system_id: u32)
pub fn remove_system(&mut self, system_id: u32)
Removes the given entity
.
sourcepub fn entity_component_manager(&mut self) -> &mut EntityComponentManager<E>
pub fn entity_component_manager(&mut self) -> &mut EntityComponentManager<E>
Borrows mutable the entity component manager.
sourcepub fn print_entity(&self, entity: impl Into<Entity>)
pub fn print_entity(&self, entity: impl Into<Entity>)
Print infos about the given entity.
sourcepub fn run_with_context(&mut self, ctx: &mut Ctx)
pub fn run_with_context(&mut self, ctx: &mut Ctx)
Run all systems of the world and calls run_with_context
of the systems with the given context.
Trait Implementations
sourceimpl<E, Ctx> Drop for World<E, Ctx> where
E: EntityStore,
impl<E, Ctx> Drop for World<E, Ctx> where
E: EntityStore,
impl<E, Ctx> Send for World<E, Ctx> where
E: EntityStore,
Auto Trait Implementations
impl<E, Ctx> !RefUnwindSafe for World<E, Ctx>
impl<E, Ctx> !Sync for World<E, Ctx>
impl<E, Ctx> Unpin for World<E, Ctx> where
E: Unpin,
impl<E, Ctx> !UnwindSafe for World<E, Ctx>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more