pub struct Entity {
pub id: EntityID,
pub parent: Option<EntityID>,
pub first_child: Option<EntityID>,
pub next: Option<EntityID>,
pub first_component: Option<Component>,
pub z_order: i32,
pub order_of_arrival: i32,
pub global_order_of_arrival: i32,
}
Expand description
A node in the entity hierarchy, and a collection of components.
To iterate over the hierarchy, use the parent, first_child, next and first_component fields. For example:
Fields
id: EntityID
parent: Option<EntityID>
This entity’s parent
first_child: Option<EntityID>
This entity’s first child
next: Option<EntityID>
This entity’s next sibling, for iteration
first_component: Option<Component>
This entity’s first component
z_order: i32
order_of_arrival: i32
global_order_of_arrival: i32
Implementations
sourceimpl Entity
impl Entity
pub fn new() -> Entity
sourcepub fn add(&self, component: Component) -> &Entity
pub fn add(&self, component: Component) -> &Entity
Add a component to this entity. Any previous component of this type will be replaced. @returns This instance, for chaining.
sourcepub fn remove(&self, component: &Component) -> bool
pub fn remove(&self, component: &Component) -> bool
Remove a component from this entity. @return Whether the component was removed.
sourcepub fn add_child(
&self,
entity: Entity,
append: bool,
z_order: Option<i32>
) -> &Entity
pub fn add_child(
&self,
entity: Entity,
append: bool,
z_order: Option<i32>
) -> &Entity
Gets a component by name from this entity. Adds a child to this entity. @param append Whether to add the entity to the end or beginning of the child list. @returns This instance, for chaining.
pub fn set_zorder(&mut self, z: i32)
pub fn remove_child(&self, entity: &Entity)
sourcepub fn dispose_children(&self)
pub fn dispose_children(&self)
Dispose all of this entity’s children, without touching its own components or removing itself from its parent.
Trait Implementations
sourceimpl AsRef<MoviePlayer> for Entity
impl AsRef<MoviePlayer> for Entity
sourcefn as_ref(&self) -> &MoviePlayer
fn as_ref(&self) -> &MoviePlayer
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Disposable for Entity
impl Disposable for Entity
sourceimpl EntityManager<EmitterSprite> for Entity
impl EntityManager<EmitterSprite> for Entity
fn get(&self) -> Option<EmitterSprite>
sourceimpl EntityManager<FillSprite> for Entity
impl EntityManager<FillSprite> for Entity
fn get(&self) -> Option<FillSprite>
sourceimpl EntityManager<ImageSprite> for Entity
impl EntityManager<ImageSprite> for Entity
fn get(&self) -> Option<ImageSprite>
sourceimpl EntityManager<MoviePlayer> for Entity
impl EntityManager<MoviePlayer> for Entity
fn get(&self) -> Option<MoviePlayer>
sourceimpl EntityManager<MovieSprite> for Entity
impl EntityManager<MovieSprite> for Entity
fn get(&self) -> Option<MovieSprite>
sourceimpl EntityManager<PatternSprite> for Entity
impl EntityManager<PatternSprite> for Entity
fn get(&self) -> Option<PatternSprite>
sourceimpl EntityManager<SpeedAdjuster> for Entity
impl EntityManager<SpeedAdjuster> for Entity
fn get(&self) -> Option<SpeedAdjuster>
sourceimpl EntityManager<TextSprite> for Entity
impl EntityManager<TextSprite> for Entity
fn get(&self) -> Option<TextSprite>
sourceimpl PartialOrd<Entity> for Entity
impl PartialOrd<Entity> for Entity
sourcefn partial_cmp(&self, other: &Entity) -> Option<Ordering>
fn partial_cmp(&self, other: &Entity) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Entity
Auto Trait Implementations
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnwindSafe for Entity
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
impl<T> Clamp<T> for T where
T: PartialOrd<T>,
impl<T> Clamp<T> for T where
T: PartialOrd<T>,
fn clamped(self, min: T, max: T) -> T
impl<'a, T, C, M> Inspect<'a, C, &'a C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a mut C, M> for T
impl<'a, T, C, M> Inspect<'a, C, &'a mut C, M> for T
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
fn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.