com.threerings.media.sprite
Class OrientableImageSprite
java.lang.Object
com.threerings.media.AbstractMedia
com.threerings.media.sprite.Sprite
com.threerings.media.sprite.ImageSprite
com.threerings.media.sprite.OrientableImageSprite
- All Implemented Interfaces:
- Pathable, DirectionCodes, Shape
- Direct Known Subclasses:
- FadableImageSprite
public class OrientableImageSprite
- extends ImageSprite
An image sprite that uses AWT's rotation methods to render itself in
different orientations.
| 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 |
| Methods inherited from class com.threerings.media.sprite.Sprite |
addSpriteObserver, cancelMove, contains, fastForward, getHeight, getOrientation, getPath, getWidth, getX, getXOffset, getY, getYOffset, inside, intersects, isMoving, move, paintPath, pathBeginning, pathCompleted, removeSpriteObserver, setLocation, shutdown, tickPath, 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, willStart |
OrientableImageSprite
public OrientableImageSprite()
- Creates a new orientable image sprite.
OrientableImageSprite
public OrientableImageSprite(Mirage image)
- Creates a new orientable image sprite.
- Parameters:
image - the image to render
OrientableImageSprite
public OrientableImageSprite(MultiFrameImage frames)
- Creates a new orientable image sprite.
- Parameters:
frames - the frames to render
accomodateFrame
protected void accomodateFrame(int frameIdx,
int width,
int height)
- Description copied from class:
ImageSprite
- Must adjust the bounds to accommodate the our new frame. This includes changing the width
and height to reflect the size of the new frame and also updating the render origin (if
necessary) and calling
Sprite.updateRenderOrigin() to reflect those changes in the
sprite's bounds.
- Overrides:
accomodateFrame in class ImageSprite
- Parameters:
frameIdx - the index of our new frame.width - the width of the new frame.height - the height of the new frame.
setOrientation
public void setOrientation(int orient)
- Description copied from class:
Sprite
- Sprites have an orientation in one of the eight cardinal directions:
DirectionCodes.NORTH, DirectionCodes.NORTHEAST, etc. Derived classes can
choose to override this member function and select a different set of images based on their
orientation, or they can ignore the orientation information.
- Specified by:
setOrientation in interface Pathable- Overrides:
setOrientation in class Sprite
- See Also:
DirectionCodes
paint
public void paint(Graphics2D graphics)
- 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 ImageSprite