Interface IAnimationController
- All Superinterfaces:
IUpdateable
- All Known Subinterfaces:
IEntityAnimationController<T>
- All Known Implementing Classes:
AnimationController,CreatureAnimationController,EntityAnimationController,PropAnimationController
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the specifiedAnimationto this controller instance.voidadd(ImageEffect effect) Adds the specifiedImageEffectto be applied when the current image is retrieved from this controller.voidaddListener(AnimationListener listener) Adds the specified animation listener to receive events and callbacks when animation playbacks are started and finished.voidclear()Remove allAnimations from theAnimationController.Gets theAnimationinstance with the specified name from this controller.Gets theAffineTransforminstance assigned to this controller that can be used to externally transform the current image when rendering it with theImageRenderer.getAll()Gets allAnimationinstances managed by this controller.Gets the currently activeAnimationof this controller.Gets the current sprite (keyframe) of the currently active animation of this controller.getCurrentImage(int width, int height) Gets the current sprite scaled by the specified dimensions of the currently active animation of this controller.Gets the defaultAnimationof this controller.Gets all image effects assigned to this controller.booleanhasAnimation(String animationName) Determines whether this controller has anAnimationwith the specified name.booleanDetermines whether this controller is currently enabled.booleanDetermines whether this controller is currently playing anAnimationwith the specified name.voidPlays theAnimationwith the specified name.voidRemoves the specifiedAnimationfrom this controller instance.voidremove(ImageEffect effect) Removes the specifiedImageEffectfrom this controller.voidremoveListener(AnimationListener listener) Removes the specified animation listener.voidsetAffineTransform(AffineTransform affineTransform) Sets theAffineTransforminstance for this controller that can be used to externally transform the current image when rendering it with theImageRenderer.voidsetDefault(Animation animation) Sets the specifiedAnimationas default for this controller.voidsetEnabled(boolean enabled) Sets a flag that defines whether this controller is enabled or not.Methods inherited from interface de.gurkenlabs.litiengine.IUpdateable
update
-
Method Details
-
addListener
Adds the specified animation listener to receive events and callbacks when animation playbacks are started and finished.- Parameters:
listener- The listener to add.
-
removeListener
Removes the specified animation listener.- Parameters:
listener- The listener to remove.
-
add
Add the specifiedAnimationto this controller instance.Animations with the same name will be replaced by this method.
- Parameters:
animation- The animation to add.- See Also:
-
remove
Removes the specifiedAnimationfrom this controller instance.- Parameters:
animation- The animation to remove.- See Also:
-
clear
void clear()Remove allAnimations from theAnimationController. -
getAll
Collection<Animation> getAll()Gets allAnimationinstances managed by this controller.- Returns:
- All
Animationinstances.
-
get
Gets theAnimationinstance with the specified name from this controller.The name of an
Animationis case sensitive.- Parameters:
animationName- The name of the animation.- Returns:
- The animation with the specified name or null if no such animation is managed by this controller.
- See Also:
-
getCurrent
Animation getCurrent()Gets the currently activeAnimationof this controller.The current active animation provides the current image that is being rendered by consumers of this controller (e.g. the render engine or any explicit, custom render mechanism).
- Returns:
- The currently active animation.
- See Also:
-
getDefault
Animation getDefault()Gets the defaultAnimationof this controller.This animation is played when no other animation is currently active.
- Returns:
- The default animation of this controller.
- See Also:
-
hasAnimation
Determines whether this controller has anAnimationwith the specified name.The name of an
Animationis case sensitive.- Parameters:
animationName- The name of the animation.- Returns:
- True if this controller contains an
Animationwith the specified name; otherwise false. - See Also:
-
isPlaying
Determines whether this controller is currently playing anAnimationwith the specified name.The name of an
Animationis case sensitive.- Parameters:
animationName- The name of the animation.- Returns:
- True if this controller is currently playing the
Animationwith the specified name. - See Also:
-
play
Plays theAnimationwith the specified name.Does nothing if this controller doesn't contain an
Animationwith the specified name.This method also publishes the "played" event to all subscribed
AnimationListenerinstances.- Parameters:
animationName- The name of theAnimationto be played.- See Also:
-
setDefault
Sets the specifiedAnimationas default for this controller.- Parameters:
animation- The animation to be set as default.- See Also:
-
getCurrentImage
BufferedImage getCurrentImage()Gets the current sprite (keyframe) of the currently active animation of this controller.The implementation of this method applies all registered
ImageEffects.- Returns:
- The current sprite of the current animation with applied effects; or null, if this controller is currently disabled.
- See Also:
-
getCurrentImage
Gets the current sprite scaled by the specified dimensions of the currently active animation of this controller.The implementation of this method applies all registered
ImageEffects.- Parameters:
width- The width of the image.height- The height of the image.- Returns:
- The current sprite of the current animation scaled by the defined dimensions with applied effects; or null, if this controller is currently disabled.
- See Also:
-
getAffineTransform
AffineTransform getAffineTransform()Gets theAffineTransforminstance assigned to this controller that can be used to externally transform the current image when rendering it with theImageRenderer.- Returns:
- The
AffineTransforminstance assigned to this controller or null. - See Also:
-
setAffineTransform
Sets theAffineTransforminstance for this controller that can be used to externally transform the current image when rendering it with theImageRenderer.- Parameters:
affineTransform- TheAffineTransforminstance for this controller.- See Also:
-
add
Adds the specifiedImageEffectto be applied when the current image is retrieved from this controller.- Parameters:
effect- The image effect to be added.
-
remove
Removes the specifiedImageEffectfrom this controller.- Parameters:
effect- The image effect to be removed.
-
getImageEffects
List<ImageEffect> getImageEffects()Gets all image effects assigned to this controller.- Returns:
- All image effects of this controller.
- See Also:
-
isEnabled
boolean isEnabled()Determines whether this controller is currently enabled.- Returns:
- True if this controller is enabled; otherwise false.
-
setEnabled
void setEnabled(boolean enabled) Sets a flag that defines whether this controller is enabled or not.- Parameters:
enabled- True if the controller should be enabled; otherwise false.
-