Trait rinecs::EntitiesCreationExt[][src]

pub trait EntitiesCreationExt<'a> {
    fn with_entities_creation<'e, F, R>(&'e mut self, f: F) -> R
    where
        F: FnOnce(EntitiesCreation<'e>) -> R
;
fn new_entity(&mut self) -> EntityBuilder<'_>;
fn creation_storage<C: Component>(&mut self) -> CreationSto<'_, C>; fn add_component_to<'r, C: ComponentSend>(
        &mut self,
        entity: &Entity,
        component: C
    )
    where
        <C as Component>::Storage: Storage<'s, C>,
        <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter
, { ... }
fn add_component_to_thread_local<'r, C: ComponentThreadLocal>(
        &mut self,
        entity: &Entity,
        component: C
    )
    where
        <C as Component>::Storage: Storage<'s, C>,
        <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter
, { ... }
fn add_tag_to<C: 'static>(&mut self, entity: &Entity) { ... }
fn add_child_component_to<'r, C: ComponentSend>(
        &mut self,
        parent: &Entity,
        entity: &Entity,
        component: C
    )
    where
        <C as Component>::Storage: HierarchicalStorage<'b, C>,
        <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter
, { ... }
fn add_child_component_to_thread_local<'r, C: ComponentThreadLocal>(
        &mut self,
        parent: &Entity,
        entity: &Entity,
        component: C
    )
    where
        <C as Component>::Storage: HierarchicalStorage<'b, C>,
        <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter
, { ... }
fn add_slice_component_to<'r, C, I>(
        &mut self,
        entity: &Entity,
        component: I
    )
    where
        C: OneToNComponentSend,
        <C as Component>::Storage: OneToNStorage<'s, C>,
        <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
        I: IntoIterator<Item = C>
, { ... }
fn add_slice_component_to_thread_local<'r, C, I>(
        &mut self,
        entity: &Entity,
        component: I
    )
    where
        C: OneToNComponentThreadLocal,
        <C as Component>::Storage: OneToNStorage<'s, C>,
        <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
        I: IntoIterator<Item = C>
, { ... }
fn remove_component_from<'r, C: Component>(&mut self, entity: &Entity)
    where
        <C as Component>::Storage: Storage<'s, C>,
        <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter
, { ... }
fn remove_entity(&mut self, entity: &Entity) { ... } }

Trait implemented by World and CreationProxy allows to create functions that can create new entities, components and resources without relying on an specific object

That way a such function can be called during initialization passing a World as parameter or during run time passing a CreationProxy

Wrappers for World should implement this trait

Required methods

fn with_entities_creation<'e, F, R>(&'e mut self, f: F) -> R where
    F: FnOnce(EntitiesCreation<'e>) -> R, 
[src]

fn new_entity(&mut self) -> EntityBuilder<'_>[src]

Returns an EntityBuilder that allows to create an entity and it’s components.

let e = world.new_entity()
    .add(Position{x: 0., y: 0.})
    .add(Velocity{x: 0., y: 0.})
    .build();

fn creation_storage<C: Component>(&mut self) -> CreationSto<'_, C>[src]

Loading content...

Provided methods

fn add_component_to<'r, C: ComponentSend>(
    &mut self,
    entity: &Entity,
    component: C
) where
    <C as Component>::Storage: Storage<'s, C>,
    <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter
[src]

Adds a Send Component to an already existing Entity.

fn add_component_to_thread_local<'r, C: ComponentThreadLocal>(
    &mut self,
    entity: &Entity,
    component: C
) where
    <C as Component>::Storage: Storage<'s, C>,
    <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter
[src]

Adds a non Send Component to an already existing Entity.

fn add_tag_to<C: 'static>(&mut self, entity: &Entity)[src]

Adds a Tag to an already existing Entity.

fn add_child_component_to<'r, C: ComponentSend>(
    &mut self,
    parent: &Entity,
    entity: &Entity,
    component: C
) where
    <C as Component>::Storage: HierarchicalStorage<'b, C>,
    <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter
[src]

Adds a Send Component to an already existing Entity.

fn add_child_component_to_thread_local<'r, C: ComponentThreadLocal>(
    &mut self,
    parent: &Entity,
    entity: &Entity,
    component: C
) where
    <C as Component>::Storage: HierarchicalStorage<'b, C>,
    <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter
[src]

Adds a non Send Component to an already existing Entity.

fn add_slice_component_to<'r, C, I>(&mut self, entity: &Entity, component: I) where
    C: OneToNComponentSend,
    <C as Component>::Storage: OneToNStorage<'s, C>,
    <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
    I: IntoIterator<Item = C>, 
[src]

Adds a Send OneToNComponent to an already existing Entity.

This allows to add a slice of components to an entity instead of only one component. This components are stored contiguously in memory for all the entities.

fn add_slice_component_to_thread_local<'r, C, I>(
    &mut self,
    entity: &Entity,
    component: I
) where
    C: OneToNComponentThreadLocal,
    <C as Component>::Storage: OneToNStorage<'s, C>,
    <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter,
    I: IntoIterator<Item = C>, 
[src]

Adds a non Send OneToNComponent to an already existing Entity.

This allows to add a slice of components to an entity instead of only one component. This components are stored contiguously in memory for all the entities.

fn remove_component_from<'r, C: Component>(&mut self, entity: &Entity) where
    <C as Component>::Storage: Storage<'s, C>,
    <<C as Component>::Storage as Storage<'r, C>>::Get: DebugParameter
[src]

Removes a compoenent of the specified type from an entity.

fn remove_entity(&mut self, entity: &Entity)[src]

Removes an Entity and all it’s compoenents.

Loading content...

Implementors

impl<'a> EntitiesCreationExt<'a> for EntitiesCreation<'a>[src]

impl<'a> EntitiesCreationExt<'a> for EntityStoragesCreation<'a>[src]

impl<'a> EntitiesCreationExt<'a> for World[src]

Loading content...