com.b3dgs.lionengine.game.background
Class AbstractBackground

java.lang.Object
  extended by com.b3dgs.lionengine.game.background.AbstractBackground
All Implemented Interfaces:
Background

public abstract class AbstractBackground
extends java.lang.Object
implements Background

AbstractBackground skeleton, used for future backgrounds implementation.


Field Summary
protected  java.util.List<BackgroundComponent> components
          List of components contained by this background.
protected  int componentsNumber
          Number of background components.
protected  int maxY
          Minimum/maximum background value.
protected  int minY
          Minimum/maximum background value.
protected  java.lang.String theme
          Background theme name.
protected  int totalHeight
          Total background height.
protected  boolean wide
          Wide state.
 
Constructor Summary
AbstractBackground(java.lang.String theme, int min, int max, boolean wide)
          Create a new background.
 
Method Summary
protected  void add(BackgroundComponent component)
          Add a component to the background.
protected  BackgroundElement createElement(java.lang.String path, java.lang.String name, int x, int y, boolean alpha)
          Create an element from a path and its name, plus its coordinates.
protected  Sprite createSprite(java.lang.String filename, boolean alpha)
          Create a sprite from its filename.
 void render(java.awt.Graphics2D g)
          Background renderings.
 void update(float speed, float y, float extrp)
          Background updates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

components

protected final java.util.List<BackgroundComponent> components
List of components contained by this background.


maxY

protected final int maxY
Minimum/maximum background value.


minY

protected final int minY
Minimum/maximum background value.


wide

protected final boolean wide
Wide state.


totalHeight

protected int totalHeight
Total background height.


componentsNumber

protected int componentsNumber
Number of background components.


theme

protected final java.lang.String theme
Background theme name.

Constructor Detail

AbstractBackground

public AbstractBackground(java.lang.String theme,
                          int min,
                          int max,
                          boolean wide)
Create a new background.

Parameters:
theme - background theme.
min - minimal y value for background.
max - maximal y value for background.
wide - wide state.
Method Detail

update

public final void update(float speed,
                         float y,
                         float extrp)
Description copied from interface: Background
Background updates.

Specified by:
update in interface Background
Parameters:
speed - scrolling speed.
y - background y.
extrp - extrapolation value.

render

public final void render(java.awt.Graphics2D g)
Description copied from interface: Background
Background renderings.

Specified by:
render in interface Background
Parameters:
g - graphic output.

add

protected void add(BackgroundComponent component)
Add a component to the background.

Parameters:
component - component reference.

createSprite

protected Sprite createSprite(java.lang.String filename,
                              boolean alpha)
Create a sprite from its filename.

Parameters:
filename - filename.
Returns:
sprite instance.

createElement

protected BackgroundElement createElement(java.lang.String path,
                                          java.lang.String name,
                                          int x,
                                          int y,
                                          boolean alpha)
Create an element from a path and its name, plus its coordinates.

Parameters:
path - element path.
name - element name.
x - location x.
y - location y.
Returns:
created element.