Bandidos
Classes | Public Member Functions | List of all members
com.mygdx.game.engine.entities.components.rendering.Animations Class Reference

Public Member Functions

 Animations (String defaultAnimationName, RenderInfo defaultAnimationRenderInfo, boolean loopAnimation)
 
 Animations (String defaultAnimationName, RenderInfo defaultAnimationRenderInfo, boolean loopAnimation, boolean backwards)
 
boolean hasAnimation (String name)
 
void setAnimation (String name, RenderInfo renderInfo, boolean loopAnimation)
 
void setAnimation (String name, RenderInfo renderInfo, boolean loopAnimation, boolean backwards)
 
void removeAnimation (String name)
 
RenderInfo getAnimation (String name)
 
void setLoopForAnimation (String name, boolean loopAnimation)
 
boolean isLoopAnimation (String name)
 
boolean isBackwardsAnimation (String name)
 
String getDefaultAnimationName ()
 
RenderInfo getDefaultAnimation ()
 
void clean ()
 

Detailed Description

This is a container for RenderInfos which the AnimationComponent uses to set and play animations by generic names. This allows, for example, a user of the AnimationComponent to call the 'Run' animation and it will play a generic animation under the given name. This class must be cleaned by calling the 'clean' method if it is being disposed.

Author
Ramses Di Perna

Constructor & Destructor Documentation

◆ Animations() [1/2]

com.mygdx.game.engine.entities.components.rendering.Animations.Animations ( String  defaultAnimationName,
RenderInfo  defaultAnimationRenderInfo,
boolean  loopAnimation 
)

The animation needs a default starting point. This starting point can be overwritten by 'setAnimation' but can not be removed with 'removeAnimation'

Parameters
defaultAnimationNameto call the default animation by. This can be requested by the method 'getDefaultAnimationName'
defaultAnimationRenderInfowhich is used as animation. This can be requested by the method 'getDefaultAnimation'

◆ Animations() [2/2]

com.mygdx.game.engine.entities.components.rendering.Animations.Animations ( String  defaultAnimationName,
RenderInfo  defaultAnimationRenderInfo,
boolean  loopAnimation,
boolean  backwards 
)

The animation needs a default starting point. This starting point can be overwritten by 'setAnimation' but can not be removed with 'removeAnimation'

Parameters
defaultAnimationNameto call the default animation by. This can be requested by the method 'getDefaultAnimationName'
defaultAnimationRenderInfowhich is used as animation. This can be requested by the method 'getDefaultAnimation'
loopAnimationindicates whether this animation should loop when it has reached its end frame
backwardsindicates whether this animation should be played from the last from to the first or not. True is last to first, false is first to last.

Member Function Documentation

◆ clean()

void com.mygdx.game.engine.entities.components.rendering.Animations.clean ( )

This cleans all saved memory from the class and makes it 'null'. This breaks the class for future use and the class references should be set to 'null' after this method is called

◆ getAnimation()

RenderInfo com.mygdx.game.engine.entities.components.rendering.Animations.getAnimation ( String  name)

Returns an animation added with 'setAnimation' or the default animation name. If an animation under the given name is not found, there will be a warning message and the return value will be 'null'

Parameters
nameof the needed animation
Returns
The RenderInfo which can be used as animation. Returns 'null' if the given name was not added to this Animations class

◆ getDefaultAnimation()

RenderInfo com.mygdx.game.engine.entities.components.rendering.Animations.getDefaultAnimation ( )

Returns the default animation given in the constructor.

Returns
The RenderInfo which represents the default animation.

◆ getDefaultAnimationName()

String com.mygdx.game.engine.entities.components.rendering.Animations.getDefaultAnimationName ( )

Returns the default animation name given in the constructor.

Returns
Name of default animation

◆ hasAnimation()

boolean com.mygdx.game.engine.entities.components.rendering.Animations.hasAnimation ( String  name)

Returns whether there is an animation in this Animations class which has the name given as parameter.

Parameters
nameof animation to check on existence in this class.
Returns
True is this animation is set in this class, else false

◆ isBackwardsAnimation()

boolean com.mygdx.game.engine.entities.components.rendering.Animations.isBackwardsAnimation ( String  name)

Returns the original backwards purpose set for the animation

Parameters
nameof the needed animation to get backwards information for
Returns
Of the animations was meant to be played backwards or not

◆ isLoopAnimation()

boolean com.mygdx.game.engine.entities.components.rendering.Animations.isLoopAnimation ( String  name)

Returns the original loop purpose set for the animation

Parameters
nameof the needed animation to get loop information for
Returns
If the animation was meant to be played as a loop or not.

◆ removeAnimation()

void com.mygdx.game.engine.entities.components.rendering.Animations.removeAnimation ( String  name)

Removes an animation under the given name from this Animations class.

Parameters
nameto remove

◆ setAnimation() [1/2]

void com.mygdx.game.engine.entities.components.rendering.Animations.setAnimation ( String  name,
RenderInfo  renderInfo,
boolean  loopAnimation 
)

Creates or replaces an animation under the given name with the given RenderInfo

Parameters
nameto call the animation by
renderInfowhich is used as animation

◆ setAnimation() [2/2]

void com.mygdx.game.engine.entities.components.rendering.Animations.setAnimation ( String  name,
RenderInfo  renderInfo,
boolean  loopAnimation,
boolean  backwards 
)

Creates or replaces an animation under the given name with the given RenderInfo

Parameters
nameto call the animation by
renderInfowhich is used as animation

◆ setLoopForAnimation()

void com.mygdx.game.engine.entities.components.rendering.Animations.setLoopForAnimation ( String  name,
boolean  loopAnimation 
)

Sets the animation's looping option with the given name with the given value

Parameters
nameof animation to set looping option
loopAnimationto set it to

The documentation for this class was generated from the following file: