Struct dces::entity::EntityComponentManager [−][src]
The EntityComponentManager represents the main entity and component storage.
Fields
entities: HashMap<Entity, HashMap<TypeId, Box<Any>>>
The entities with its components.
Methods
impl EntityComponentManager
[src]
impl EntityComponentManager
pub fn new() -> Self
[src]
pub fn new() -> Self
Create sa new entity component manager.
pub fn register_entity(&mut self, entity: Entity)
[src]
pub fn register_entity(&mut self, entity: Entity)
Register a new entity
.
pub fn remove_entity(&mut self, entity: Entity)
[src]
pub fn remove_entity(&mut self, entity: Entity)
Removes a entity
from the manager.
pub fn register_component<C: Component>(&mut self, entity: Entity, component: C)
[src]
pub fn register_component<C: Component>(&mut self, entity: Entity, component: C)
Register a component
for the given entity
.
pub fn register_component_box(
&mut self,
entity: Entity,
component_box: ComponentBox
)
[src]
pub fn register_component_box(
&mut self,
entity: Entity,
component_box: ComponentBox
)
Register a component_box
for the given entity
.
pub fn borrow_component<C: Component>(
&self,
entity: Entity
) -> Result<&C, NotFound>
[src]
pub fn borrow_component<C: Component>(
&self,
entity: Entity
) -> Result<&C, NotFound>
Returns a refernce of a component of type C
from the given entity
. If the entity does
not exists or it dosen't have a component of type C
NotFound
will be returned.
pub fn borrow_mut_component<C: Component>(
&mut self,
entity: Entity
) -> Result<&mut C, NotFound>
[src]
pub fn borrow_mut_component<C: Component>(
&mut self,
entity: Entity
) -> Result<&mut C, NotFound>
Returns a mutable refernce of a component of type C
from the given entity
. If the entity does
not exists or it dosen't have a component of type C
NotFound
will be returned.
Trait Implementations
impl Default for EntityComponentManager
[src]
impl Default for EntityComponentManager
fn default() -> EntityComponentManager
[src]
fn default() -> EntityComponentManager
Returns the "default value" for a type. Read more
Auto Trait Implementations
impl !Send for EntityComponentManager
impl !Send for EntityComponentManager
impl !Sync for EntityComponentManager
impl !Sync for EntityComponentManager