pub struct Scene<I: ImageSize> { /* private fields */ }
Expand description
A scene is used to manage sprite’s life and run animation with sprite
Implementations
sourceimpl<I: ImageSize> Scene<I>
impl<I: ImageSize> Scene<I>
sourcepub fn event<E>(&mut self, e: &E) where
E: GenericEvent,
pub fn event<E>(&mut self, e: &E) where
E: GenericEvent,
Update animation’s state
sourcepub fn draw_tinted<B: Graphics<Texture = I>>(
&self,
t: Matrix2d,
b: &mut B,
c: [f32; 3]
)
pub fn draw_tinted<B: Graphics<Texture = I>>(
&self,
t: Matrix2d,
b: &mut B,
c: [f32; 3]
)
Render this scene with tint
sourcepub fn run(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
pub fn run(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
Register animation with sprite
sourcepub fn pause(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
pub fn pause(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
Pause a running animation of the sprite
sourcepub fn resume(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
pub fn resume(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
Resume a paused animation of the sprite
sourcepub fn toggle(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
pub fn toggle(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
Toggle an animation of the sprite
sourcepub fn stop(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
pub fn stop(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
Stop a running animation of the sprite
sourcepub fn running_for_child(&self, sprite_id: Uuid) -> Option<usize>
pub fn running_for_child(&self, sprite_id: Uuid) -> Option<usize>
Get the number of running animations for a sprite. If sprite does not exist, returns None.
sourcepub fn remove_child(&mut self, id: Uuid) -> Option<Sprite<I>>
pub fn remove_child(&mut self, id: Uuid) -> Option<Sprite<I>>
Remove the child by id
from the scene’s children or grandchild
will stop all the animations run by this child
sourcepub fn remove_child_when_done(&mut self, id: Uuid)
pub fn remove_child_when_done(&mut self, id: Uuid)
Remove the child by id
from the scene’s children or grandchild once
all of its animations have finished. If the child current has no
animations, it is removed immediately. Children with paused animations
will not be removed until the animations are resumed and completed.
sourcepub fn child(&self, id: Uuid) -> Option<&Sprite<I>>
pub fn child(&self, id: Uuid) -> Option<&Sprite<I>>
Find the child by id
from the scene’s children or grandchild
Auto Trait Implementations
impl<I> RefUnwindSafe for Scene<I> where
I: RefUnwindSafe,
impl<I> !Send for Scene<I>
impl<I> !Sync for Scene<I>
impl<I> Unpin for Scene<I>
impl<I> UnwindSafe for Scene<I> where
I: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more