|
GTGE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.golden.gamedev.object.Background
com.golden.gamedev.object.background.ColorBackground
public class ColorBackground
The very basic background type that only fill the background view port with a single color.
This type of background use a fixed memory size. Memory used by small size color background (e.g: 1 x 1) with an extremely large size color background (e.g: 100,000,000 x 100,000,000) is equal.
Field Summary |
---|
Fields inherited from class com.golden.gamedev.object.Background |
---|
screen, x, y |
Constructor Summary | |
---|---|
ColorBackground(Color bgColor)
Creates new ColorBackground as large as screen dimension. |
|
ColorBackground(Color bgColor,
int w,
int h)
Creates new ColorBackground with specified size. |
Method Summary | |
---|---|
Color |
getColor()
Returns this background color. |
void |
render(Graphics2D g,
int xbg,
int ybg,
int x,
int y,
int w,
int h)
Renders background from specified position and clipping area to specified graphics context. |
void |
setColor(Color bgColor)
Sets the background color. |
Methods inherited from class com.golden.gamedev.object.Background |
---|
getClip, getDefaultBackground, getHeight, getWidth, getX, getY, move, render, setClip, setClip, setLocation, setSize, setToCenter, setToCenter, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ColorBackground(Color bgColor, int w, int h)
ColorBackground
with specified size.
public ColorBackground(Color bgColor)
ColorBackground
as large as screen dimension.
Method Detail |
---|
public Color getColor()
public void setColor(Color bgColor)
public void render(Graphics2D g, int xbg, int ybg, int x, int y, int w, int h)
Background
This method to simplify background subclass rendering, the subclass only need to render the background from specified x, y coordinate with specified clipping area.
For example:
Background backgr; Graphics2D g; backgr.render(g, 100, 100, 5, 10, 100, 200);Means the background must render itself from background coordinate 100, 100 to specified graphics context, starting from 5, 10 screen pixel as large as 100 x 200 dimension.
render
in class Background
g
- graphics contextxbg
- background x-coordinateybg
- background y-coordinatex
- screen start x clippingy
- screen start y clippingw
- clipping widthh
- clipping height
|
GTGE API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |