pub struct MoviePlayer {
pub inner: Component,
pub movie: Option<MovieSprite>,
pub looping: bool,
/* private fields */
}
Expand description
A convenient controller to play though multiple different movies. Designed for characters and objects that have a separate Flump symbol for each of their animations, and need to switch between them. The played movies will be added to a new child entity of the owner.
Fields
inner: Component
movie: Option<MovieSprite>
The movie currently being shown.
looping: bool
Whether the current movie is being looped.
Implementations
sourceimpl MoviePlayer
impl MoviePlayer
pub fn new(lib: Library) -> Self
sourcepub fn set_cache(&mut self, cache: bool) -> &Self
pub fn set_cache(&mut self, cache: bool) -> &Self
Configures whether this MoviePlayer will keep a cache of all its MovieSprites, rather than creating a new instance for each play. This makes switching movies faster, at the expense of memory. By default, the cache is enabled. If this MoviePlayer plays lots of different movies, but doesn’t match through them too often, consider disabling the cache. @returns This instance, for chaining.
sourcepub fn set_decorator(
&mut self,
decorator: Option<Rc<dyn Fn(MovieSprite)>>
) -> &Self
pub fn set_decorator(
&mut self,
decorator: Option<Rc<dyn Fn(MovieSprite)>>
) -> &Self
Configures the callback used to decorate newly created MovieSprites, if any. This can be used to dress up avatars or other custom initialization. @returns This instance, for chaining.
sourcepub fn play(&mut self, name: String, restart: bool) -> &Self
pub fn play(&mut self, name: String, restart: bool) -> &Self
Shows a movie that plays once. When it completes, the last looping movie is returned to. It is an error to call this without starting a loop() first. @param name The symbol name of the movie to play. @param restart If this movie is already being played, whether it will restart it from the beginning. @returns This instance, for chaining.
sourcepub fn play_with_loop(&mut self, name: String, restart: bool) -> &Self
pub fn play_with_loop(&mut self, name: String, restart: bool) -> &Self
Shows a movie that loops forever. @param name The symbol name of the movie to loop. @param restart If this movie is already being looped, whether it will restart it from the beginning. @returns This instance, for chaining.
pub fn on_added(&self)
pub fn on_removed(&mut self)
pub fn on_update(&mut self, dt: f32)
Trait Implementations
sourceimpl AsRef<Component> for MoviePlayer
impl AsRef<Component> for MoviePlayer
sourceimpl AsRef<MoviePlayer> for Entity
impl AsRef<MoviePlayer> for Entity
sourcefn as_ref(&self) -> &MoviePlayer
fn as_ref(&self) -> &MoviePlayer
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Clone for MoviePlayer
impl Clone for MoviePlayer
sourcefn clone(&self) -> MoviePlayer
fn clone(&self) -> MoviePlayer
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for MoviePlayer
impl Debug for MoviePlayer
sourceimpl Default for MoviePlayer
impl Default for MoviePlayer
sourcefn default() -> MoviePlayer
fn default() -> MoviePlayer
Returns the “default value” for a type. Read more
sourceimpl EntityManager<MoviePlayer> for Entity
impl EntityManager<MoviePlayer> for Entity
fn get(&self) -> Option<MoviePlayer>
Auto Trait Implementations
impl !RefUnwindSafe for MoviePlayer
impl !Send for MoviePlayer
impl !Sync for MoviePlayer
impl Unpin for MoviePlayer
impl !UnwindSafe for MoviePlayer
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<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
impl<Fr, To> IntoColor<To> for Fr where
To: FromColor<Fr>,
sourcefn into_color(self) -> To
fn into_color(self) -> To
Convert into color
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.