Struct keeshond::scene::SceneControl
source · [−]pub struct SceneControl<T: SceneType + 'static> { /* private fields */ }
Expand description
Control for adding and removing Entities and Components while the scene is running.
Implementations
sourceimpl<T: SceneType + 'static> SceneControl<T>
impl<T: SceneType + 'static> SceneControl<T>
sourcepub fn add_entity_later(&mut self) -> Entity
pub fn add_entity_later(&mut self) -> Entity
Adds an Entity after the current ThinkerSystem::think() finishes. Returns the Entity which you can immediately schedule adding components to using SceneControl::add_component_later().
sourcepub fn remove_entity_later(&mut self, entity: &Entity)
pub fn remove_entity_later(&mut self, entity: &Entity)
Removes the given Entity and all its Components after the current ThinkerSystem::think() finishes.
sourcepub fn add_component_later<C: Component + 'static>(
&mut self,
entity: &Entity,
component: C
)
pub fn add_component_later<C: Component + 'static>(
&mut self,
entity: &Entity,
component: C
)
Adds a Component to the given Entity after the current ThinkerSystem::think() finishes.
sourcepub fn remove_component_later<C: Component + 'static>(
&mut self,
entity: &Entity
)
pub fn remove_component_later<C: Component + 'static>(
&mut self,
entity: &Entity
)
Removes the given Component from the given Entity after the current ThinkerSystem::think() finishes.
sourcepub fn spawn_later(
&mut self,
spawnable_id: T::SpawnableIdType,
game: &mut GameControl,
x: f64,
y: f64
) -> Entity
pub fn spawn_later(
&mut self,
spawnable_id: T::SpawnableIdType,
game: &mut GameControl,
x: f64,
y: f64
) -> Entity
Spawns an object with pre-configured Components after the current ThinkerSystem::think() finishes. The Components to assign are given by the implementation of SceneType::spawn() for the current scene.
sourcepub fn spawn_later_with(
&mut self,
spawnable_id: T::SpawnableIdType,
game: &mut GameControl,
x: f64,
y: f64,
args: &DynArgList
) -> Entity
pub fn spawn_later_with(
&mut self,
spawnable_id: T::SpawnableIdType,
game: &mut GameControl,
x: f64,
y: f64,
args: &DynArgList
) -> Entity
Spawns an object with pre-configured Components after the current ThinkerSystem::think() finishes. The Components to assign are given by the implementation of SceneType::spawn() for the current scene. The given DynArgList may be used to influence how the Components are created.
sourcepub fn set_entity_frozen_later(
&mut self,
entity: &Entity,
freeze_flags: FreezeFlags,
freeze: bool
)
pub fn set_entity_frozen_later(
&mut self,
entity: &Entity,
freeze_flags: FreezeFlags,
freeze: bool
)
Sets or unsets the FreezeFlags for the given Entity and all its Components after the current ThinkerSystem::think() finishes.
sourcepub fn register_callbacks_later<C: Component + 'static>(
&mut self,
callbacks: ComponentCallbacks
)
pub fn register_callbacks_later<C: Component + 'static>(
&mut self,
callbacks: ComponentCallbacks
)
Registers a set of callbacks after the current ThinkerSystem::think() finishes. These callbacks will fire whenever a Component of this type is added or removed. The callbacks are not guaranteed to be called in the exact order that the components were created in this frame, as multiple components of a given type may be batched together. The callbacks will not be called if the component is assigned to directly.
sourcepub fn deferred_reserve_capacity_hint(&mut self, additional: usize)
pub fn deferred_reserve_capacity_hint(&mut self, additional: usize)
(Advanced) Hints to the deferred spawning system that this many additional Components may be created. This is a performance tuning option and in most cases you probably don’t need or want to use this.
Auto Trait Implementations
impl<T> !RefUnwindSafe for SceneControl<T>
impl<T> !Send for SceneControl<T>
impl<T> !Sync for SceneControl<T>
impl<T> Unpin for SceneControl<T> where
T: Unpin,
impl<T> !UnwindSafe for SceneControl<T>
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
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more