|
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.ImageBackground
public class ImageBackground
Background that use a single image as the background.
Field Summary |
---|
Fields inherited from class com.golden.gamedev.object.Background |
---|
screen, x, y |
Constructor Summary | |
---|---|
ImageBackground(BufferedImage image)
Creates new ImageBackground with specified image
and the background size is as large as the image. |
|
ImageBackground(BufferedImage image,
int w,
int h)
Creates new ImageBackground with specified image
and background size. |
Method Summary | |
---|---|
BufferedImage |
getImage()
Returns this background image. |
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 |
setImage(BufferedImage image)
Sets this background image, and the size of this background is set to the image size. |
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 ImageBackground(BufferedImage image, int w, int h)
ImageBackground
with specified image
and background size.
public ImageBackground(BufferedImage image)
ImageBackground
with specified image
and the background size is as large as the image.
Method Detail |
---|
public BufferedImage getImage()
public void setImage(BufferedImage image)
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 |