com.b3dgs.lionengine.drawable
Interface ParallaxedSprite

All Superinterfaces:
Renderable

public interface ParallaxedSprite
extends Renderable

ParallaxedSprites are used for parallax effect (2.5D perspective). It cuts a sprite surface into an array of lines. They are scaled using a trapeze representation, for the perspective effect.


Method Summary
 int getHeightOriginal()
          Get the current sprite height (its current size, after scaling operation).
 java.awt.image.BufferedImage getLine(int line)
          Get a parallax line (first index is 0).
 int getWidthOriginal()
          Get the current sprite width (its current size, after scaling operation).
 void prepare(Filter filter)
          Update all changes.
 void render(java.awt.Graphics2D g, int line, int x, int y)
          Render a line of parallax to the specified coordinates.
 void scale(int percent)
          Method used for sprite scaling, in order to modify its size.
 void stretch(int percentWidth, int percentHeight)
          Works as scale, but using differents width and height factor.
 
Methods inherited from interface com.b3dgs.lionengine.drawable.Renderable
getHeight, getWidth, render
 

Method Detail

scale

void scale(int percent)
Method used for sprite scaling, in order to modify its size. Normal factor is equal to 100, so 200 will scale it twice bigger, whereas 50 will scale half its size.

Parameters:
percent - value for scaling.

stretch

void stretch(int percentWidth,
             int percentHeight)
Works as scale, but using differents width and height factor. Using different values, the ratio won't be kept, and the sprite will be different !

Parameters:
percentWidth - percent value for scaling width.
percentHeight - percent value for scaling height.

prepare

void prepare(Filter filter)
Update all changes. Need to be called when changes are done.

Parameters:
filter - filter to use.

render

void render(java.awt.Graphics2D g,
            int line,
            int x,
            int y)
Render a line of parallax to the specified coordinates.

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

getWidthOriginal

int getWidthOriginal()
Get the current sprite width (its current size, after scaling operation).

Returns:
sprite width size as integer.

getHeightOriginal

int getHeightOriginal()
Get the current sprite height (its current size, after scaling operation).

Returns:
sprite height size as integer.

getLine

java.awt.image.BufferedImage getLine(int line)
Get a parallax line (first index is 0).

Parameters:
line - desired line.
Returns:
line's surface.