com.b3dgs.lionengine.drawable
Interface AnimatedSprite

All Superinterfaces:
Animator, Image, Renderable, Sprite

public interface AnimatedSprite
extends Sprite, Animator

AnimatedSprite is an extended sprite, as it is now able to play it, using animations data. It works like a sprite expected it renders only a part of it (animation job). Animation data contains the first/last frame and the animation speed. Considering the main first frame is on the top-left sprite surface, and the last frame is on the down-right sprite surface, reading it from left to right. The first frame number is 1.

See Also:
Animation, AnimState

Method Summary
 java.awt.image.BufferedImage getFrame(int frame)
          Get the representative surface of a frame.
 int getFrameHeight()
          Get current frame height.
 int getFrameOriginalHeight()
          Get original frame height.
 int getFrameOriginalWidth()
          Get original frame width.
 int getFramesNumber()
          Get the number of frames.
 int getFrameWidth()
          Get current frame width.
 int getHorizontalFrames()
          Get the number of horizontal frames.
 int getVerticalFrames()
          Get the number of vertical frames.
 AnimatedSprite instanciate()
          Get instancied version of current animated sprite (shares the same surface).
 void render(java.awt.Graphics2D g, int x, int y)
          Render active frame on graphic output at specified coordinates.
 void render(java.awt.Graphics2D g, int x, int y, boolean mirror)
          Render active frame on graphic output at specified coordinates.
 void render(java.awt.Graphics2D g, int frame, int x, int y)
          Render a specific frame on graphic output at specified coordinates.
 void render(java.awt.Graphics2D g, int frame, int x, int y, boolean mirror)
          Render a specific frame on graphic output at specified coordinates.
 
Methods inherited from interface com.b3dgs.lionengine.drawable.Sprite
filter, flipHorizontal, flipVertical, getHeightOriginal, getSurface, getWidthOriginal, load, rotate, scale, setAlpha, setTransparency, stretch
 
Methods inherited from interface com.b3dgs.lionengine.drawable.Renderable
getHeight, getWidth
 
Methods inherited from interface com.b3dgs.lionengine.drawable.Animator
getAnimState, getFrame, getRealFrame, play, play, play, setFrame, setSkipLastFrameOnReverse, stopAnimation, updateAnimation
 

Method Detail

render

void render(java.awt.Graphics2D g,
            int x,
            int y)
Render active frame on graphic output at specified coordinates.

Specified by:
render in interface Renderable
Parameters:
g - graphic output.
x - abscissa.
y - ordinate.

render

void render(java.awt.Graphics2D g,
            int frame,
            int x,
            int y)
Render a specific frame on graphic output at specified coordinates.

Parameters:
g - graphic output.
frame - frame to render.
x - abscissa.
y - ordinate.

render

void render(java.awt.Graphics2D g,
            int x,
            int y,
            boolean mirror)
Render active frame on graphic output at specified coordinates.

Parameters:
g - graphic output.
x - abscissa.
y - ordinate.
mirror - true if it is a mirror rendering (rendering is flipped).

render

void render(java.awt.Graphics2D g,
            int frame,
            int x,
            int y,
            boolean mirror)
Render a specific frame on graphic output at specified coordinates.

Parameters:
g - graphic output.
frame - frame to render.
x - abscissa.
y - ordinate.
mirror - true if it is a mirror rendering (rendering is flipped).

getHorizontalFrames

int getHorizontalFrames()
Get the number of horizontal frames.

Returns:
number of horizontal frames.

getVerticalFrames

int getVerticalFrames()
Get the number of vertical frames.

Returns:
number of vertical frames.

getFramesNumber

int getFramesNumber()
Get the number of frames.

Returns:
number of frames.

getFrameWidth

int getFrameWidth()
Get current frame width.

Returns:
tile width.

getFrameHeight

int getFrameHeight()
Get current frame height.

Returns:
tile height.

getFrameOriginalWidth

int getFrameOriginalWidth()
Get original frame width.

Returns:
tile width.

getFrameOriginalHeight

int getFrameOriginalHeight()
Get original frame height.

Returns:
tile height.

getFrame

java.awt.image.BufferedImage getFrame(int frame)
Get the representative surface of a frame.

Parameters:
frame - frame to get.
Returns:
frame's surface.

instanciate

AnimatedSprite instanciate()
Get instancied version of current animated sprite (shares the same surface).

Specified by:
instanciate in interface Image
Specified by:
instanciate in interface Sprite
Returns:
cloned animated sprite.