public abstract class BackgroundGame extends Object implements Background
Modifier and Type | Field and Description |
---|---|
protected List<BackgroundComponent> |
components
List of components contained by this background.
|
protected int |
maxY
Minimum background value.
|
protected int |
minY
Maximum background value.
|
protected String |
theme
Background theme name.
|
protected int |
totalHeight
Total background height.
|
Constructor and Description |
---|
BackgroundGame(String theme,
int min,
int max)
Constructor base.
|
Modifier and Type | Method and Description |
---|---|
protected void |
add(BackgroundComponent component)
Add a component to the background.
|
static BackgroundElement |
createElement(String name,
int x,
int y)
Create an element from a name, plus its coordinates.
|
static BackgroundElement |
createElement(String path,
String name,
int x,
int y)
Create an element from a path and its name, plus its coordinates.
|
protected static Sprite |
createSprite(Media media)
Create a sprite from its filename.
|
int |
getComponentsNumber()
Get the components number.
|
int |
getOffsetY()
Get the y offset.
|
String |
getTheme()
Get the background theme.
|
void |
render(Graphic g)
Background renderings.
|
protected void |
renderComponent(int index,
Graphic g)
Render the specified component.
|
protected void |
setOffsetY(int offsetY)
Set the y offset.
|
void |
update(double extrp,
double speed,
double y)
Background updates.
|
protected final List<BackgroundComponent> components
protected final int maxY
protected final int minY
protected final String theme
protected int totalHeight
public BackgroundGame(String theme, int min, int max)
theme
- The background theme.min
- The minimal y value for background.max
- The maximal y value for background.public static BackgroundElement createElement(String name, int x, int y)
name
- The element name.x
- The location x.y
- The location y.LionEngineException
- If media is null
or image cannot be read.public static BackgroundElement createElement(String path, String name, int x, int y)
path
- The element path.name
- The element name.x
- The location x.y
- The location y.LionEngineException
- If media is null
or image cannot be read.protected static Sprite createSprite(Media media)
media
- The sprite media.LionEngineException
- If media is null
or image cannot be read.public int getOffsetY()
public String getTheme()
public int getComponentsNumber()
protected void add(BackgroundComponent component)
component
- The component reference.protected void renderComponent(int index, Graphic g)
index
- The component index.g
- The graphic output.protected void setOffsetY(int offsetY)
offsetY
- The y offset.public final void update(double extrp, double speed, double y)
Background
update
in interface Background
extrp
- The extrapolation value.speed
- The scrolling speed.y
- The background y.public final void render(Graphic g)
Background
render
in interface Background
g
- The graphic output.Copyright © 2016 Byron 3D Games Studio. All rights reserved.