[][src]Struct sprite::Scene

pub struct Scene<I: ImageSize> { /* fields omitted */ }

A scene is used to manage sprite's life and run animation with sprite

Methods

impl<I: ImageSize> Scene<I>[src]

pub fn new() -> Scene<I>[src]

Create a new scene

pub fn event<E>(&mut self, e: &E) where
    E: GenericEvent, 
[src]

Update animation's state

pub fn draw<B: Graphics<Texture = I>>(&self, t: Matrix2d, b: &mut B)[src]

Render this scene

pub fn draw_tinted<B: Graphics<Texture = I>>(
    &self,
    t: Matrix2d,
    b: &mut B,
    c: [f32; 3]
)
[src]

Render this scene with tint

pub fn run(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)[src]

Register animation with sprite

pub fn pause(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)[src]

Pause a running animation of the sprite

pub fn resume(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)[src]

Resume a paused animation of the sprite

pub fn toggle(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)[src]

Toggle an animation of the sprite

pub fn stop(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)[src]

Stop a running animation of the sprite

pub fn stop_all(&mut self, sprite_id: Uuid)[src]

Stop all running animations of the sprite

pub fn running(&self) -> usize[src]

Get all the running animations in the scene

pub fn running_for_child(&self, sprite_id: Uuid) -> Option<usize>[src]

Get the number of running animations for a sprite. If sprite does not exist, returns None.

pub fn add_child(&mut self, sprite: Sprite<I>) -> Uuid[src]

Add sprite to scene

pub fn remove_child(&mut self, id: Uuid) -> Option<Sprite<I>>[src]

Remove the child by id from the scene's children or grandchild will stop all the animations run by this child

pub fn remove_child_when_done(&mut self, id: Uuid)[src]

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.

pub fn child(&self, id: Uuid) -> Option<&Sprite<I>>[src]

Find the child by id from the scene's children or grandchild

pub fn child_mut(&mut self, id: Uuid) -> Option<&mut Sprite<I>>[src]

Find the child by id from this sprite's children or grandchild, mutability

pub fn children(&self) -> &Vec<Sprite<I>>[src]

Get the list of top-level (non-child) sprites.

Auto Trait Implementations

impl<I> !Sync for Scene<I>

impl<I> !Send for Scene<I>

impl<I> Unpin for Scene<I>

impl<I> UnwindSafe for Scene<I> where
    I: RefUnwindSafe

impl<I> !RefUnwindSafe for Scene<I>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]