com.threerings.media.animation
Class AnimationSprite
java.lang.Object
com.threerings.media.AbstractMedia
com.threerings.media.sprite.Sprite
com.threerings.media.animation.AnimationSprite
- All Implemented Interfaces:
- Pathable, DirectionCodes, Shape
public class AnimationSprite
- extends Sprite
A Sprite that wraps an animation so that a sequence of frames can be easily moved around the
screen. Animations embedded here should not be added directly to a media panel as this sprite
will manage them. If the enclosed animation completes, we remove the sprite from the media
panel, since the animation would normally do that itself.
| Fields inherited from interface com.threerings.util.DirectionCodes |
CARDINAL_DIRECTIONS, CCW, CW, DIRECTION_COUNT, DOWN, EAST, EASTNORTHEAST, EASTSOUTHEAST, FINE_DIRECTION_COUNT, HORIZONTAL, LEFT, NONE, NORTH, NORTHEAST, NORTHNORTHEAST, NORTHNORTHWEST, NORTHWEST, RIGHT, SOUTH, SOUTHEAST, SOUTHSOUTHEAST, SOUTHSOUTHWEST, SOUTHWEST, UP, VERTICAL, WEST, WESTNORTHWEST, WESTSOUTHWEST |
|
Method Summary |
void |
init()
Called when the media has had its manager set. |
void |
paint(Graphics2D gfx)
Called by the appropriate manager to request that the media render itself with the given
graphics context. |
void |
setLocation(int x,
int y)
Set the location. |
void |
tick(long tickStamp)
Called periodically by this media's manager to give it a chance to do its thing. |
void |
willStart(long tickStamp)
Prior to the first call to AbstractMedia.tick(long) on an abstract media, this method is called by the
AbstractMediaManager. |
| Methods inherited from class com.threerings.media.sprite.Sprite |
addSpriteObserver, cancelMove, contains, fastForward, getHeight, getOrientation, getPath, getWidth, getX, getXOffset, getY, getYOffset, hitTest, inside, intersects, isMoving, move, paintPath, pathBeginning, pathCompleted, removeSpriteObserver, setOrientation, shutdown, tickPath, toString, updateRenderOrigin, viewLocationDidChange |
| Methods inherited from class com.threerings.media.AbstractMedia |
addObserver, contains, contains, contains, contains, getBounds, getBounds2D, getPathIterator, getPathIterator, getRenderOrder, init, intersects, intersects, invalidate, invalidateAfterChange, naturalCompareTo, queueNotification, removeObserver, renderCompareTo, setRenderOrder, toString |
_anim
protected Animation _anim
_owner
protected MediaPanel _owner
AnimationSprite
public AnimationSprite(Animation anim,
MediaPanel owner)
init
public void init()
- Description copied from class:
AbstractMedia
- Called when the media has had its manager set.
Derived classes may override this method, but should be sure to call
super.init().
- Overrides:
init in class AbstractMedia
tick
public void tick(long tickStamp)
- Description copied from class:
AbstractMedia
- Called periodically by this media's manager to give it a chance to do its thing.
- Overrides:
tick in class Sprite
- Parameters:
tickStamp - a time stamp associated with this tick. Note: this is not obtained
from a call to System.currentTimeMillis() and cannot be compared to timestamps
obtained there from.
setLocation
public void setLocation(int x,
int y)
- Description copied from class:
AbstractMedia
- Set the location.
- Specified by:
setLocation in interface Pathable- Overrides:
setLocation in class Sprite
willStart
public void willStart(long tickStamp)
- Description copied from class:
AbstractMedia
- Prior to the first call to
AbstractMedia.tick(long) on an abstract media, this method is called by the
AbstractMediaManager. It is called during the normal tick cycle, immediately prior
to the first call to AbstractMedia.tick(long).
Note: It is imperative that super.willStart() is called by any
entity that overrides this method because the AbstractMediaManager depends on the
setting of the AbstractMedia._firstTick value to know whether or not to call this method.
- Overrides:
willStart in class AbstractMedia
paint
public void paint(Graphics2D gfx)
- Description copied from class:
AbstractMedia
- Called by the appropriate manager to request that the media render itself with the given
graphics context. The media may wish to inspect the clipping region that has been set on the
graphics context to render itself more efficiently. This method will only be called after it
has been established that this media's bounds intersect the clipping region.
- Overrides:
paint in class Sprite