public class AnimatedSpriteImpl extends SpriteImpl implements AnimatedSprite
height, heightOriginal, surface, width, widthOriginal
Constructor and Description |
---|
AnimatedSpriteImpl(java.awt.image.BufferedImage surface,
int horizontalFrames,
int verticalFrames) |
AnimatedSpriteImpl(java.lang.String filename,
int horizontalFrames,
int verticalFrames) |
Modifier and Type | Method and Description |
---|---|
AnimatedSprite |
clone()
Get cloned version of current sprite.
|
int |
getFrame()
Get the current playing frame number.
|
java.awt.image.BufferedImage |
getFrame(int frame)
Get the representative surface of a frame (first frame is 1).
|
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 |
getState()
Get the current animation state.
|
int |
getVerticalFrames()
Get the number of vertical frames.
|
void |
play(Animation animation)
Play the animated sprite with a specific animation, previously created.
|
void |
play(Animation animation,
float speed)
Play the animated sprite with a specific animation, previously created.
|
void |
play(int start,
int end,
float speed,
boolean reverse,
boolean repeat)
Play the animated sprite with a specific animation, previously created.
|
void |
render(java.awt.Graphics2D g,
int x,
int y)
Render image on current graphic output, at specified coordinates.
|
void |
render(java.awt.Graphics2D g,
int x,
int y,
boolean mirror)
Render a frame on graphic output at specified coordinates.
|
void |
render(java.awt.Graphics2D g,
int frame,
int x,
int y)
Render a specified frame on graphic output at specified coordinates.
|
void |
render(java.awt.Graphics2D g,
int frame,
int x,
int y,
boolean mirror)
Render a specified frame on graphic output at specified coordinates.
|
void |
setFrame(int frame)
Set a fixed frame.
|
void |
stop()
Stop the current animation.
|
java.lang.String |
toString() |
void |
update(float extrp)
Set the current extrapolation value (in main loop).
|
filter, flipHorizontal, flipVertical, getHeight, getHeightOriginal, getSurface, getWidth, getWidthOriginal, rotate, scale, stretch
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
filter, flipHorizontal, flipVertical, getHeightOriginal, getSurface, getWidthOriginal, rotate, scale, stretch
getHeight, getWidth
public AnimatedSpriteImpl(java.lang.String filename, int horizontalFrames, int verticalFrames)
public AnimatedSpriteImpl(java.awt.image.BufferedImage surface, int horizontalFrames, int verticalFrames)
public void play(Animation animation)
AnimatedSprite
play
in interface AnimatedSprite
animation
- animation reference.public void play(Animation animation, float speed)
AnimatedSprite
play
in interface AnimatedSprite
animation
- animation reference.speed
- specified speed.public void play(int start, int end, float speed, boolean reverse, boolean repeat)
AnimatedSprite
play
in interface AnimatedSprite
start
- first frame to play.end
- last frame to reach.speed
- specified speed.reverse
- reverse play when end is reach.repeat
- play in loop.public void stop()
AnimatedSprite
stop
in interface AnimatedSprite
public void update(float extrp)
AnimatedSprite
update
in interface AnimatedSprite
extrp
- extrapolation value.public void render(java.awt.Graphics2D g, int x, int y)
Renderable
render
in interface AnimatedSprite
render
in interface Renderable
render
in class SpriteImpl
g
- graphic output.x
- abscissa.y
- ordinate.public void render(java.awt.Graphics2D g, int x, int y, boolean mirror)
AnimatedSprite
render
in interface AnimatedSprite
g
- graphic output.x
- abscissa.y
- ordinate.mirror
- true if it is a mirror rendering.public void render(java.awt.Graphics2D g, int frame, int x, int y)
AnimatedSprite
render
in interface AnimatedSprite
g
- graphic output.frame
- frame to render.x
- abscissa.y
- ordinate.public void render(java.awt.Graphics2D g, int frame, int x, int y, boolean mirror)
AnimatedSprite
render
in interface AnimatedSprite
g
- graphic output.frame
- frame to render.x
- abscissa.y
- ordinate.mirror
- true if it is a mirror rendering.public void setFrame(int frame)
AnimatedSprite
setFrame
in interface AnimatedSprite
frame
- frame to set.public int getState()
AnimatedSprite
getState
in interface AnimatedSprite
public int getFrame()
AnimatedSprite
getFrame
in interface AnimatedSprite
public int getFrameWidth()
AnimatedSprite
getFrameWidth
in interface AnimatedSprite
public int getFrameHeight()
AnimatedSprite
getFrameHeight
in interface AnimatedSprite
public int getFrameOriginalWidth()
AnimatedSprite
getFrameOriginalWidth
in interface AnimatedSprite
public int getFrameOriginalHeight()
AnimatedSprite
getFrameOriginalHeight
in interface AnimatedSprite
public int getHorizontalFrames()
AnimatedSprite
getHorizontalFrames
in interface AnimatedSprite
public int getVerticalFrames()
AnimatedSprite
getVerticalFrames
in interface AnimatedSprite
public int getFramesNumber()
AnimatedSprite
getFramesNumber
in interface AnimatedSprite
public java.awt.image.BufferedImage getFrame(int frame)
AnimatedSprite
getFrame
in interface AnimatedSprite
frame
- frame to get.public java.lang.String toString()
toString
in class SpriteImpl
public AnimatedSprite clone()
Sprite
clone
in interface AnimatedSprite
clone
in interface Image
clone
in interface Sprite
clone
in class SpriteImpl