|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.piratis.j2me.core.game.Layer
Abstract class representing a visual element of a game.
Each Layer has its Bounding Box (position plus width and height)
and visibility features. It is mandatory for subclasses to implement
the paint(Graphics) method!
Bear in mind that the layer's position is always relative to the Graphics
coordinate system.
Field Summary | |
protected BBox2D |
bbox
Own's bbox (initially empty!) |
static int |
TOP_LEFT
|
protected boolean |
visible
Visibility management |
Constructor Summary | |
Layer()
|
Method Summary | |
BBox2D |
getBbox()
Returns own bounding box, always in pixel values |
boolean |
isVisible()
Gets the visibility of this layer |
void |
moveBy(int dx,
int dy)
Moves the current layer the given horizontal and vertical distances. |
void |
moveTo(int x,
int y)
Moves the layer's top-left corner at the given (x,y) coordinates |
abstract void |
paint(Graphics g)
Paints this layer if it is visible. |
void |
setVisible(boolean newVisible)
Sets the visibility of the layer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static int TOP_LEFT
protected BBox2D bbox
protected boolean visible
Constructor Detail |
public Layer()
Method Detail |
public BBox2D getBbox()
BBox2D
public boolean isVisible()
true
if the layer is visible, false
otherwise.public void setVisible(boolean newVisible)
newVisible
- true
to make this layer visible,
false
otherwise.public void moveBy(int dx, int dy)
dx
- horizontal axis distance (positive to the right, negative to the left)dy
- vertical axis distance (positive downwards, negative upwards)public void moveTo(int x, int y)
x
- the horizontal positiony
- the vertical positionpublic abstract void paint(Graphics g)
g
- the graphics object for rendering this layer
|
Copyright(c) 2003-2004 Jordi Martin | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |