Class PropAnimationController<T extends Prop>
java.lang.Object
de.gurkenlabs.litiengine.graphics.animation.AnimationController
de.gurkenlabs.litiengine.graphics.animation.EntityAnimationController<T>
de.gurkenlabs.litiengine.graphics.animation.PropAnimationController<T>
- All Implemented Interfaces:
IEntityController
,IAnimationController
,IEntityAnimationController<T>
,IUpdateable
public class PropAnimationController<T extends Prop>
extends EntityAnimationController<T>
Nested Class Summary
Nested classes/interfaces inherited from class de.gurkenlabs.litiengine.graphics.animation.EntityAnimationController
EntityAnimationController.AnimationRule<T extends IEntity>
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROP_IDENTIFIER
Constructor Summary
Constructors Constructor Description PropAnimationController(T prop)
Initializes a new instance of thePropAnimationController
class.Method Summary
Modifier and Type Method Description java.awt.image.BufferedImage
getCurrentImage()
Gets the current sprite (keyframe) of the currently active animation of this controller.static java.lang.String
getSpriteName(Prop prop, boolean appendState)
Gets the sprite name for the specified prop and state.static java.lang.String
getSpriteName(Prop prop, PropState state, boolean appendState)
Gets the sprite name for the specified prop and state.boolean
isAutoScaling()
Gets a flag indicating whether this controller instance is auto scaling its animations by the dimensions of the entity.void
update()
This method is called by the game loop on all objects that are attached to the loop.Methods inherited from class de.gurkenlabs.litiengine.graphics.animation.EntityAnimationController
addRule, addRule, getDefaultSpritePrefixes, getEntity, getSpritePrefix, scaleSprite, scaleSprite, setAutoScaling, setSpritePrefix
Methods inherited from class de.gurkenlabs.litiengine.graphics.animation.AnimationController
add, add, addListener, attach, buildCurrentCacheKey, clear, detach, flipAnimation, get, getAffineTransform, getAll, getCurrent, getCurrentImage, getDefault, getImageEffects, hasAnimation, isEnabled, isPlaying, play, remove, remove, removeListener, setAffineTransform, setDefault, setEnabled
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.gurkenlabs.litiengine.graphics.animation.IAnimationController
add, add, addListener, clear, get, getAffineTransform, getAll, getCurrent, getCurrentImage, getDefault, getImageEffects, hasAnimation, isEnabled, isPlaying, play, remove, remove, removeListener, setAffineTransform, setDefault, setEnabled
Field Details
PROP_IDENTIFIER
public static final java.lang.String PROP_IDENTIFIER- See Also:
- Constant Field Values
Constructor Details
PropAnimationController
Initializes a new instance of thePropAnimationController
class.- Parameters:
prop
- The prop related to this controller.
Method Details
getSpriteName
Gets the sprite name for the specified prop and state.- Parameters:
prop
- The prop to retrieve the sprite name for.appendState
- A flag indicating whether the state should be appended to the name.- Returns:
- A string representing the sprite name for the specified prop in its state.
- See Also:
Prop.getSpritesheetName()
,Prop.getState()
getSpriteName
Gets the sprite name for the specified prop and state.- Parameters:
prop
- The prop to retrieve the sprite name for.state
- The state of the prop.appendState
- A flag indicating whether the state should be appended to the name.- Returns:
- A string representing the sprite name for the specified prop in its state.
- See Also:
Prop.getSpritesheetName()
,Prop.getState()
getCurrentImage
public java.awt.image.BufferedImage getCurrentImage()Description copied from interface:IAnimationController
Gets the current sprite (keyframe) of the currently active animation of this controller.The implementation of this method applies all registered
ImageEffects
.- Specified by:
getCurrentImage
in interfaceIAnimationController
- Overrides:
getCurrentImage
in classAnimationController
- Returns:
- The current sprite of the current animation with applied effects; or null, if this controller is currently disabled.
- See Also:
IAnimationController.getCurrent()
,Animation.getCurrentKeyFrame()
,IAnimationController.isEnabled()
update
public void update()Description copied from interface:IUpdateable
This method is called by the game loop on all objects that are attached to the loop. It's called on every tick of the loop and the frequency can be configured using theClientConfiguration
.- Specified by:
update
in interfaceIUpdateable
- Overrides:
update
in classEntityAnimationController<T extends Prop>
- See Also:
ClientConfiguration.setMaxFps(int)
isAutoScaling
public boolean isAutoScaling()Description copied from interface:IEntityAnimationController
Gets a flag indicating whether this controller instance is auto scaling its animations by the dimensions of the entity.- Specified by:
isAutoScaling
in interfaceIEntityAnimationController<T extends Prop>
- Overrides:
isAutoScaling
in classEntityAnimationController<T extends Prop>
- Returns:
- True if this instance is automatically scaling to the dimensions of the entity; otherwise false.