Struct sprite::Scene [−][src]
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]
impl<I: ImageSize> Scene<I>
pub fn new() -> Scene<I>
[src]
pub fn new() -> Scene<I>
Create a new scene
pub fn event<E>(&mut self, e: &E) where
E: GenericEvent,
[src]
pub fn event<E>(&mut self, e: &E) where
E: GenericEvent,
Update animation's state
pub fn draw<B: Graphics<Texture = I>>(&self, t: Matrix2d, b: &mut B)
[src]
pub fn draw<B: Graphics<Texture = I>>(&self, t: Matrix2d, b: &mut B)
Render this scene
pub fn draw_tinted<B: Graphics<Texture = I>>(
&self,
t: Matrix2d,
b: &mut B,
c: [f32; 3]
)
[src]
pub fn draw_tinted<B: Graphics<Texture = I>>(
&self,
t: Matrix2d,
b: &mut B,
c: [f32; 3]
)
Render this scene with tint
pub fn run(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
[src]
pub fn run(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
Register animation with sprite
pub fn pause(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
[src]
pub fn pause(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
Pause a running animation of the sprite
pub fn resume(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
[src]
pub fn resume(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
Resume a paused animation of the sprite
pub fn toggle(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
[src]
pub fn toggle(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
Toggle an animation of the sprite
pub fn stop(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
[src]
pub fn stop(&mut self, sprite_id: Uuid, animation: &Behavior<Animation>)
Stop a running animation of the sprite
pub fn stop_all(&mut self, sprite_id: Uuid)
[src]
pub fn stop_all(&mut self, sprite_id: Uuid)
Stop all running animations of the sprite
pub fn running(&self) -> usize
[src]
pub fn running(&self) -> usize
Get all the running animations in the scene
pub fn running_for_child(&self, sprite_id: Uuid) -> Option<usize>
[src]
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.
pub fn add_child(&mut self, sprite: Sprite<I>) -> Uuid
[src]
pub fn add_child(&mut self, sprite: Sprite<I>) -> Uuid
Add sprite to scene
pub fn remove_child(&mut self, id: Uuid) -> Option<Sprite<I>>
[src]
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
pub fn remove_child_when_done(&mut self, id: Uuid)
[src]
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.
pub fn child(&self, id: Uuid) -> Option<&Sprite<I>>
[src]
pub fn child(&self, id: Uuid) -> Option<&Sprite<I>>
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]
pub fn child_mut(&mut self, id: Uuid) -> Option<&mut Sprite<I>>
Find the child by id
from this sprite's children or grandchild, mutability
pub fn children(&self) -> &Vec<Sprite<I>>
[src]
pub fn children(&self) -> &Vec<Sprite<I>>
Get the list of top-level (non-child) sprites.