|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jeffpalm.eggtris.Brick
public class Brick
The class is the building block for a Shape in Eggtris. To create one you pass in a color and size, this is all done by Shape, so there should be no need to call on this class outide of Shape. (except from possbily Board)
#eggtris.Shape
,
#eggtris.Board
Field Summary | |
---|---|
protected java.awt.Color |
color
The color, defaults to Color.green. |
protected boolean |
locked
Whether this Brick is free to move. |
protected int |
size
Size of this Brick, defaults to 0. |
protected int |
x
X position, defaults to 0. |
protected int |
y
Y position, defaults to 0. |
Constructor Summary | |
---|---|
Brick(java.awt.Color color,
int x,
int y,
int size)
Instatiates a new Brick, initially it is free to move (!locked). |
Method Summary | |
---|---|
void |
draw(java.awt.Graphics g)
Draw this on the passed in Grahics context. |
void |
lock(Board board)
Locks this brick (says it cannot move anymore) and puts this on the Board passed in. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.awt.Color color
protected int x
protected int y
protected int size
protected boolean locked
#eggtris.Shape.givesItsBricksTo
Constructor Detail |
---|
public Brick(java.awt.Color color, int x, int y, int size)
color
- Sets the color of this Brick.x
- Sets the x position.y
- Sets the y postion.size
- Sets the size, both height and width.Method Detail |
---|
public void draw(java.awt.Graphics g)
g
- Graphics context on which to draw.public void lock(Board board)
board
- Board on which to lock and put this.eggtris.Board
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |