Struct mold2d::sprite::Animations
[−]
[src]
pub struct Animations<State> { /* fields omitted */ }
An animation manager that retrieves the animations for a state
Methods
impl<State> Animations<State> where
State: Clone + Eq + Hash,
[src]
State: Clone + Eq + Hash,
fn new(fps: f64) -> Animations<State>
fn add(&mut self, s: State, anims: Vec<Sprite>, bound: BoundingBox)
fn anim(&mut self, s: &State) -> Option<&AnimatedSprite>
Returns an immutable reference to the animation for the given state
fn anim_mut(&mut self, s: &State) -> Option<&mut AnimatedSprite>
Returns a mutable reference to the animation for the given state
fn bbox(&mut self, s: &State) -> Option<&BoundingBox>
Returns an immutable reference to the bounding box for the given state
fn bbox_mut(&mut self, s: &State) -> Option<&mut BoundingBox>
Returns a mutable reference to the bounding box for the given state
fn map_bbox_mut<F>(&mut self, f: F) where
F: Fn(&mut BoundingBox),
F: Fn(&mut BoundingBox),
Maps a function that mutates a bounding box over all of the bounding boxes in the animation
fn collides_with(
&mut self,
s: &State,
other_bbox: &Option<BoundingBox>
) -> Option<CollisionSide>
&mut self,
s: &State,
other_bbox: &Option<BoundingBox>
) -> Option<CollisionSide>
Checks if the animation at the state collides with another bounding box and returns the side of the collision if it happens
fn add_time(&mut self, s: &State, elapsed: f64)
Adds time to the current animation
fn render(
&mut self,
s: &State,
rect: &SpriteRectangle,
viewport: &mut Viewport,
renderer: &mut Renderer,
debug: bool
)
&mut self,
s: &State,
rect: &SpriteRectangle,
viewport: &mut Viewport,
renderer: &mut Renderer,
debug: bool
)
Renders an animation in the manager