Bandidos
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
com.mygdx.game.engine.entities.components.rendering.AnimationComponent Class Reference
Inheritance diagram for com.mygdx.game.engine.entities.components.rendering.AnimationComponent:
com.mygdx.game.engine.entities.components.rendering.RenderComponent com.mygdx.game.engine.entities.components.BaseEntityComponent com.mygdx.game.engine.events.EventDispatcher

Public Member Functions

 AnimationComponent (Animations animations, boolean playOnCreation, boolean isUI)
 
float getAnimationSpeed ()
 
void setAnimationSpeed (float animationSpeed)
 
String getCurrentAnimation ()
 
void setCurrentAnimation (String animationName, boolean playOnSet, boolean canBeSameAnimation)
 
void setCurrentAnimation (String animationName, boolean playOnSet)
 
int getCurrentFrame ()
 
int getAnimationLength ()
 
float getNormalizedTime ()
 
boolean isPlaying ()
 
void pause ()
 
void unpause ()
 
boolean isPaused ()
 
void play ()
 
void stop ()
 
void stopAndReset ()
 
void reset ()
 
void awake ()
 
void update (float deltaTime)
 
- Public Member Functions inherited from com.mygdx.game.engine.entities.components.rendering.RenderComponent
 RenderComponent (RenderInfo startRenderInfo, boolean isUI)
 
boolean isUserInterface ()
 
boolean isSortedOnY ()
 
int getCurrentFrameInfo ()
 
void setCurrentFrameInfo (int index)
 
void setSortOnY (boolean sortOnY)
 
double getInnerSortingLayer ()
 
int getSortingLayer ()
 
void setSortingLayer (int sortingLayer)
 
float getRealWidth ()
 
float getRealHeight ()
 
float getPivotX ()
 
float getPivotY ()
 
void setPivot (float pivotX, float pivotY, boolean keepPosition)
 
RenderInfo getRenderInfo ()
 
boolean getCallsRenderAfterEntityRender ()
 
void setCallsRenderAfterEntityRender (boolean renderAfterEntityRender)
 
void setAlpha (float alpha)
 
float getAlpha ()
 
EngineTween doAlpha (float value, float duration, TweenStartType tweenStartType)
 
EngineTween doColor (Color color, float duration, TweenStartType tweenStartType)
 
void setColor (Color color)
 
void setColor (float r, float g, float b, float a)
 
Color getColor ()
 
void setRenderInfo (RenderInfo info)
 
Texture getCurrentTexture ()
 
void setCurrentTexture (Texture texture)
 
boolean getFlipX ()
 
boolean getFlipY ()
 
void setFlipX (boolean flipX)
 
void setFlipY (boolean flipY)
 
int compare (RenderComponent d, RenderComponent d1)
 
int compareTo (RenderComponent comp)
 
void awake ()
 
- Public Member Functions inherited from com.mygdx.game.engine.entities.components.BaseEntityComponent
EngineTween startTweenOnComponent (Tween tween, TweenStartType tweenStartType)
 
Timeline startTimelineOnComponent (Timeline timeline, boolean updateInGameTime)
 
EngineTween doFloat (TweenableFloat floatToTween, float newValue, float duration, TweenStartType tweenStartType)
 
void stopAllComponentTweens ()
 
void initialize (BaseEntity parentEntity)
 
BaseEntity getParentOfComponent ()
 
boolean isActive ()
 
boolean isDestroyed ()
 
void setActiveState (boolean activeState)
 
void destroy ()
 
void update (float deltaTime)
 
abstract void awake ()
 
- Public Member Functions inherited from com.mygdx.game.engine.events.EventDispatcher
void addEventListener (String type, IEventReceiver listeningClass)
 
void dispatchEvent (Event event)
 
void removeEventListener (String type, IEventReceiver listener)
 
boolean hasEventListener (String type)
 
ArrayList< ListenerItemgetAllListeners ()
 
void destroyAllListeners ()
 
void clean ()
 

Static Public Attributes

static final String EVENT_ANIMATION_STARTED = "AnimationStartedEvent"
 
static final String EVENT_ANIMATION_LOOPED = "AnimationLoopedEvent"
 
static final String EVENT_ANIMATION_STOPPED = "AnimationStoppedEvent"
 

Protected Member Functions

void destroyed ()
 
void activeStateChanged ()
 
- Protected Member Functions inherited from com.mygdx.game.engine.entities.components.rendering.RenderComponent
void updated (float deltaTime)
 
void destroyed ()
 
void activeStateChanged ()
 
- Protected Member Functions inherited from com.mygdx.game.engine.entities.components.BaseEntityComponent
abstract void updated (float deltaTime)
 
abstract void destroyed ()
 
abstract void activeStateChanged ()
 

Detailed Description

This component is an extension on the RenderComponent and allows for animations to be played. Note: When this component is on an entity, no RenderComponent is needed.

Author
Ramses Di Perna

Constructor & Destructor Documentation

◆ AnimationComponent()

com.mygdx.game.engine.entities.components.rendering.AnimationComponent.AnimationComponent ( Animations  animations,
boolean  playOnCreation,
boolean  isUI 
)

Member Function Documentation

◆ activeStateChanged()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.activeStateChanged ( )
protected

◆ awake()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.awake ( )

◆ destroyed()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.destroyed ( )
protected

◆ getAnimationLength()

int com.mygdx.game.engine.entities.components.rendering.AnimationComponent.getAnimationLength ( )

Gets the length of the currently set animation

Returns
The length of the FrameInfo array in the RenderInfo.

◆ getAnimationSpeed()

float com.mygdx.game.engine.entities.components.rendering.AnimationComponent.getAnimationSpeed ( )

Returns the animation speed in comparison to the frame rate (DEFAULT: 0.5 (30 fps on 60 fps game))

Returns
Animation speed in normalized value

◆ getCurrentAnimation()

String com.mygdx.game.engine.entities.components.rendering.AnimationComponent.getCurrentAnimation ( )

Returns the name of the current animation

Returns
The name of the current animation

◆ getCurrentFrame()

int com.mygdx.game.engine.entities.components.rendering.AnimationComponent.getCurrentFrame ( )

Gets the current animation frame.

Returns
The current frame index displaying

◆ getNormalizedTime()

float com.mygdx.game.engine.entities.components.rendering.AnimationComponent.getNormalizedTime ( )

Gets the normalized time of the animation. (Current Frame is 5 and total frames is 10 then it returns 0.5)

Returns
Percentage played of current animation

◆ isPaused()

boolean com.mygdx.game.engine.entities.components.rendering.AnimationComponent.isPaused ( )

Returns whether the animation is paused or not.

Returns
If the animation is paused then it returns true else it returns false.

◆ isPlaying()

boolean com.mygdx.game.engine.entities.components.rendering.AnimationComponent.isPlaying ( )

Returns whether the animation is running and not paused.

Returns
If the animation is playing. True if it is else false

◆ pause()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.pause ( )

Pauses the current animation

◆ play()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.play ( )

Starts the animation from the start.

◆ reset()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.reset ( )

Resets the current animation to the first frame.

◆ setAnimationSpeed()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.setAnimationSpeed ( float  animationSpeed)

Sets the animation speed in comparison to the frame rate (DEFAULT: 0.5 (30 fps on 60 fps game))

Parameters
animationSpeednormalized value to set the new animation speed on

◆ setCurrentAnimation() [1/2]

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.setCurrentAnimation ( String  animationName,
boolean  playOnSet,
boolean  canBeSameAnimation 
)

Sets the current animation to the animation with the given name. The animations are defined in the Animations class given in the constructor.

Parameters
animationNameof the animation which should be set as current animation
playOnSetif 'true', the animation will play after it is set, else it will not
canBeSameAnimationindicates whether the animation can be the same. If not and the animation given is already the current animation, this method will not be executed, else it will always.

◆ setCurrentAnimation() [2/2]

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.setCurrentAnimation ( String  animationName,
boolean  playOnSet 
)

Sets the current animation to the animation with the given name. The animations are defined in the Animations class given in the constructor. This wont play the animation if its already playing

Parameters
animationNameof the animation which should be set as current animation
playOnSetif 'true', the animation will play after it is set, else it will not

◆ stop()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.stop ( )

Stops the animation at the current frame. Can only be undone with the 'play' method

◆ stopAndReset()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.stopAndReset ( )

Stops and resets the animation. Can only be undone with the 'play' method

◆ unpause()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.unpause ( )

UnPauses the current animation

◆ update()

void com.mygdx.game.engine.entities.components.rendering.AnimationComponent.update ( float  deltaTime)

Member Data Documentation

◆ EVENT_ANIMATION_LOOPED

final String com.mygdx.game.engine.entities.components.rendering.AnimationComponent.EVENT_ANIMATION_LOOPED = "AnimationLoopedEvent"
static

◆ EVENT_ANIMATION_STARTED

final String com.mygdx.game.engine.entities.components.rendering.AnimationComponent.EVENT_ANIMATION_STARTED = "AnimationStartedEvent"
static

◆ EVENT_ANIMATION_STOPPED

final String com.mygdx.game.engine.entities.components.rendering.AnimationComponent.EVENT_ANIMATION_STOPPED = "AnimationStoppedEvent"
static

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